sync_file_range
sync_file_range is a Linux-specific operation that initiates or waits for page-cache writeback over a file range without synchronizing file metadata or flushing volatile device write caches.
Combining WAIT_BEFORE, WRITE and WAIT_AFTER does not remove those omissions. Preallocated space can still require allocation metadata updates, and copy-on-write overwrites cannot assume in-place blocks. Use it to control writeback, not as a general replacement for fdatasync or fsync.
Relations
- related
- fsync, fdatasync, msync, writeback-error
Advantages
- Allows applications to control writeback over selected file ranges.
Limitations
- Linux-specific; not a portable persistence interface.
- WRITE alone may block under request-queue pressure.
- A successful return does not establish crash-safe availability of the data.