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

Filipe David Manana fdmanana@REDACTED
Fri Apr 23 01:14:45 CEST 2010


Hello,

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:

http://linux.die.net/man/2/fdatasync

http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.1-telco-6.1/annotate/head%3A/mysys/my_sync.c#L61
(MySQL source)

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

The patch can be found at:

http://github.com/fdmanana/otp/commit/1006fb7efafe634165214f065dd8cff05a5d10c0

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.

cheers

-- 
Filipe David Manana,
fdmanana@REDACTED

"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