aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/common/ram_file_drv.c
diff options
context:
space:
mode:
authorFilipe David Manana <[email protected]>2010-04-22 23:40:26 +0100
committerRaimo Niskanen <[email protected]>2010-05-20 15:48:17 +0200
commit3f53a96a8bd0cd4a18f819b6857e6a764706ede5 (patch)
tree04841cd714a6e23ac664a05ff9219dd8e5da474e /erts/emulator/drivers/common/ram_file_drv.c
parent80b231a0874aa5cd68c3d9f0dc7e13b6736a5dd3 (diff)
downloadotp-3f53a96a8bd0cd4a18f819b6857e6a764706ede5.tar.gz
otp-3f53a96a8bd0cd4a18f819b6857e6a764706ede5.tar.bz2
otp-3f53a96a8bd0cd4a18f819b6857e6a764706ede5.zip
Add file:datasync/1 for syncing file contents only
file:datasync/1 invokes the POSIX system call "int fdatasync(int fd)". This system call is similar to "fsync" but, unlike fsync, it does not update the metadata associated with the file (like the access time for example). It's used by many DBMSs (MySQL and SQLite of example) to increase disk IO performance, as it avoids disk seeks and disk write operations compared to fsync. More details on it at: http://linux.die.net/man/2/fdatasync An example, from the MySQL source: http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.1-telco-6.1/annotate/head%3A/mysys/my_sync.c#L61 This new function just calls fsync on systems not implementing fdatasync.
Diffstat (limited to 'erts/emulator/drivers/common/ram_file_drv.c')
-rw-r--r--erts/emulator/drivers/common/ram_file_drv.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/erts/emulator/drivers/common/ram_file_drv.c b/erts/emulator/drivers/common/ram_file_drv.c
index 4a39a156e6..d4e547ade6 100644
--- a/erts/emulator/drivers/common/ram_file_drv.c
+++ b/erts/emulator/drivers/common/ram_file_drv.c
@@ -35,6 +35,7 @@
#define RAM_FILE_TRUNCATE 14
#define RAM_FILE_PREAD 17
#define RAM_FILE_PWRITE 18
+#define RAM_FILE_FDATASYNC 19
/* other operations */
#define RAM_FILE_GET 30
@@ -558,6 +559,13 @@ static void rfile_command(ErlDrvData e, char* buf, int count)
numeric_reply(f, 0); /* 0 is not used */
break;
+ case RAM_FILE_FDATASYNC:
+ if (f->flags == 0)
+ error_reply(f, EBADF);
+ else
+ reply(f, 1, 0);
+ break;
+
case RAM_FILE_FSYNC:
if (f->flags == 0)
error_reply(f, EBADF);