From bb1a4c0b7a3fbfe2e184a98ab0b046ae87141e58 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 18 May 2021 17:22:26 -0400 Subject: [PATCH] linux::io_uring: add fsync Signed-off-by: Drew DeVault --- io_uring/sqe.ha | 14 ++++++++++++++ diff --git a/io_uring/sqe.ha b/io_uring/sqe.ha index 97a14a7bec53c3ad87f58184725b3fabae7609ca..14492cd066fc6c06d092c45116a7ca174577a711 100644 --- a/io_uring/sqe.ha +++ b/io_uring/sqe.ha @@ -109,3 +109,17 @@ assert(count <= types::U32_MAX); preprw(sqe, op::WRITE_FIXED, fd, buf, count: u32, 0, flags...); sqe.buf_index = index; }; + +// Prepares an fsync operation for an [[sqe]]. Note that operations are executed +// in parallel and not are completed in submission order, so an fsync submitted +// after a write may not cause the write to be accounted for by the fsync unless +// [[sqe_flags::IO_LINK]] is used. +export fn fsync( + sqe: *sqe, + fd: int, + fsync_flags: fsync_flags, + flags: sqe_flags... +) void = { + preprw(sqe, op::FSYNC, fd, null, 0, 0, flags...); + sqe.fsync_flags = fsync_flags; +}; -- 2.48.1