diff options
author | Andrei Vagin <avagin@google.com> | 2018-11-08 17:38:50 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-11-08 17:39:51 -0800 |
commit | 2ef122da35899591737adca296b499246b877532 (patch) | |
tree | 40750691cc2655f5292a787fecc95435414df353 /pkg/abi | |
parent | 5a0be6fa203273d1e4ab06a206eaffeca5724533 (diff) |
Implement sync_file_range()
sync_file_range - sync a file segment with disk
In Linux, sync_file_range() accepts three flags:
SYNC_FILE_RANGE_WAIT_BEFORE
Wait upon write-out of all pages in the specified range that
have already been submitted to the device driver for write-out
before performing any write.
SYNC_FILE_RANGE_WRITE
Initiate write-out of all dirty pages in the specified range
which are not presently submitted write-out. Note that even
this may block if you attempt to write more than request queue
size.
SYNC_FILE_RANGE_WAIT_AFTER
Wait upon write-out of all pages in the range after performing
any write.
In this implementation:
SYNC_FILE_RANGE_WAIT_BEFORE without SYNC_FILE_RANGE_WAIT_AFTER isn't
supported right now.
SYNC_FILE_RANGE_WRITE is skipped. It should initiate write-out of all
dirty pages, but it doesn't wait, so it should be safe to do nothing
while nobody uses SYNC_FILE_RANGE_WAIT_BEFORE.
SYNC_FILE_RANGE_WAIT_AFTER is equal to fdatasync(). In Linux,
sync_file_range() doesn't writes out the file's meta-data, but
fdatasync() does if a file size is changed.
PiperOrigin-RevId: 220730840
Change-Id: Iae5dfb23c2c916967d67cf1a1ad32f25eb3f6286
Diffstat (limited to 'pkg/abi')
-rw-r--r-- | pkg/abi/linux/fs.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/abi/linux/fs.go b/pkg/abi/linux/fs.go index 7817bfb52..0b1c9f3db 100644 --- a/pkg/abi/linux/fs.go +++ b/pkg/abi/linux/fs.go @@ -73,3 +73,10 @@ type Statfs struct { // Spare is unused. Spare [4]uint64 } + +// Sync_file_range flags, from include/uapi/linux/fs.h +const ( + SYNC_FILE_RANGE_WAIT_BEFORE = 1 + SYNC_FILE_RANGE_WRITE = 2 + SYNC_FILE_RANGE_WAIT_AFTER = 4 +) |