Patch to add a wrapper around the POSIX syscall "fdatasync"

Filipe David Manana <>
Fri Apr 23 01:14:45 CEST 2010


I created a patch which allows one to call the POSIX system call
"fdatasync". It adds a new function to the file module:  file:datasync/1.

This syscall is similar to fsync except that it doesn't flush the file's
metadata (like access time for e.g.) but only its data. Therefore it avoids
extra disk seek and disk write operations.
It's used by several DBMSs, such as MySQL and SQLite, where it makes a
significant difference compared to fsync under heavy write conditions.

Some links:
(MySQL source)

The new exposed function simply calls fsync if the host OS doesn't implement

The patch can be found at:

If something doesn't comply with your guidelines/conventions for accepting a
patch, please let me know it and I'll do the necessary adaptations.


Filipe David Manana,

"Reasonable men adapt themselves to the world.
Unreasonable men adapt the world to themselves.
That's why all progress depends on unreasonable men."

More information about the erlang-patches mailing list