RWF_DSYNC
RWF_DSYNC is a Linux per-write flag that requests synchronized data-integrity completion for the range written by pwritev2().
Documented since Linux 4.7, this is the per-call counterpart of O_DSYNC, and does not change the synchronization mode stored in the open file description. Within the preadv2/pwritev2 pair, the flag affects writes, not reads; check the returned byte count for a short transfer. [1]
Data-integrity completion includes metadata needed to retrieve the data, such as a file-length extension; it is not a metadata-free write. A timestamp-only change does not have the same retrieval requirement. [2]
Linux v6.12 combines per-call synchronization bits with inherited open-mode bits: RWF_DSYNC does not downgrade an O_SYNC file. This is source inspection, not a power-loss test. [3]
A historical ext3-ordered experiment in OSDI 2014 found that synchronizing one file waited for another file's earlier data. This illustrates coupled persistence work, not an RWF_DSYNC latency measurement. [6]
Relations
- related
- RWF_SYNC, O_DSYNC, fdatasync, Directory fsync, Short write, RWF_ATOMIC, Open file description
Advantages
- Selects data-integrity completion for a write without reopening the file.
Limitations
- Does not provide torn-write protection or a multi-file transaction.
- Does not establish persistence of a new directory entry.
- Does not promise a smaller physical flush or lower latency.
Citations
- Linux man-pages: readv(2), per-write flags and short transfers
- Linux man-pages: open(2), synchronized I/O completion
- Linux v6.12: init_sync_kiocb, iocb_flags, kiocb_set_rw_flags and generic_write_sync
- Pillai et al., OSDI 2014: All File Systems Are Not Created Equal, section 4.6 (p. 445)