Comment by blattimwind
8 years ago
A more advanced (and somewhat easy to get wrong) option would be sync_file_range combined with fdatasync, which allows to roughly emulate O_DSYNC overall but without blocking synchronously for IO.
8 years ago
A more advanced (and somewhat easy to get wrong) option would be sync_file_range combined with fdatasync, which allows to roughly emulate O_DSYNC overall but without blocking synchronously for IO.
sync_file_range is different to fsync, fdatasync and O_DSYNC in that it does not flush the disk write cache (whereas the latter explicitly do on newer kernels):
https://linux.die.net/man/2/sync_file_range:
Hence "sync_file_range combined with fdatasync". sfr is only useful to get the kernel to start the write-out now.