Author: rhuijben
Date: Mon May 20 11:50:59 2013
New Revision: 1484439

URL: http://svn.apache.org/r1484439
Log:
On OS/X (and possibly other systems implementing F_FULLFSYNC), also ask the
hardware to perform a sync (like on Windows), instead of only syncing the
data to the hardware buffers.

This matches how the sync works in sqlite and may cause a performance hit
when other data is waiting to be written in the hardware buffers, as most
disks only allow syncing the entire write buffer at once.

* subversion/libsvn_subr/io.c
  (includes): Try to include sys/ioctl.h

  (svn_io_file_flush_to_disk): Use full sync when possible.

Modified:
    subversion/trunk/subversion/libsvn_subr/io.c

Modified: subversion/trunk/subversion/libsvn_subr/io.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1484439&r1=1484438&r2=1484439&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/io.c (original)
+++ subversion/trunk/subversion/libsvn_subr/io.c Mon May 20 11:50:59 2013
@@ -51,6 +51,10 @@
 #include <arch/win32/apr_arch_file_io.h>
 #endif
 
+#if APR_HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
 #include "svn_hash.h"
 #include "svn_types.h"
 #include "svn_dirent_uri.h"
@@ -2113,7 +2117,11 @@ svn_error_t *svn_io_file_flush_to_disk(a
       int rv;
 
       do {
+#ifdef F_FULLFSYNC
+        rv = ioctl(filehand, F_FULLFSYNC, 0);
+#else
         rv = fsync(filehand);
+#endif
       } while (rv == -1 && APR_STATUS_IS_EINTR(apr_get_os_error()));
 
       /* If the file is in a memory filesystem, fsync() may return


Reply via email to