fdatasync
A system call that flushes a file's data to disk without waiting for metadata updates, making it faster than fsync() when only data consistency matters.
fdatasync() is a system call that synchronizes a file's modified data to persistent storage (disk). Unlike fsync(), it skips unnecessary metadata synchronization, only ensuring the file content itself is written.
When you write to a file in memory, the kernel buffers the data. fdatasync() forces that buffered data to be physically written to disk, guaranteeing it survives a crash or power loss.
Example use case: a database writing records. Each write calls fdatasync(fd) to guarantee data is on disk before confirming the transaction, but skips syncing timestamps and other metadata that don't affect data integrity.
Performance: fdatasync() is typically faster than fsync() because it avoids the overhead of writing inode metadata, making it ideal for applications requiring data durability but not metadata precision.