subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1711374 - /subversion/trunk/subversion/libsvn_fs_x/batch_fsync.c
Date Thu, 29 Oct 2015 22:30:08 GMT
Author: stefan2
Date: Thu Oct 29 22:30:08 2015
New Revision: 1711374

URL: http://svn.apache.org/viewvc?rev=1711374&view=rev
Log:
Eliminate most of the overhead introduced by batch fsync'ing in FSX when
we actually only fsync a single file. 

* subversion/libsvn_fs_x/batch_fsync.c
  (svn_fs_x__batch_fsync_run): Fall back to ordinary foreground processing
                               when there is nothing to parallelize.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/batch_fsync.c

Modified: subversion/trunk/subversion/libsvn_fs_x/batch_fsync.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/batch_fsync.c?rev=1711374&r1=1711373&r2=1711374&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/batch_fsync.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/batch_fsync.c Thu Oct 29 22:30:08 2015
@@ -468,20 +468,26 @@ svn_fs_x__batch_fsync_run(svn_fs_x__batc
 
 #if APR_HAS_THREADS
 
-      apr_status_t status = APR_SUCCESS;
-      status = apr_thread_pool_push(thread_pool, flush_task, to_sync,
-                                    0, NULL);
-      if (status)
-        to_sync->result = svn_error_wrap_apr(status, _("Can't push task"));
+      /* If there are multiple fsyncs to perform, run them in parallel.
+       * Otherwise, skip the thread-pool and synchronization overhead. */
+      if (apr_hash_count(batch->files) > 1)
+        {
+          apr_status_t status = APR_SUCCESS;
+          status = apr_thread_pool_push(thread_pool, flush_task, to_sync,
+                                        0, NULL);
+          if (status)
+            to_sync->result = svn_error_wrap_apr(status, _("Can't push task"));
+          else
+            tasks++;
+        }
       else
-        tasks++;
-
-#else
-
-      to_sync->result = svn_error_trace(svn_io_file_flush_to_disk
-                                           (to_sync->file, to_sync->pool));
 
 #endif
+
+        {
+          to_sync->result = svn_error_trace(svn_io_file_flush_to_disk
+                                              (to_sync->file, to_sync->pool));
+        }
     }
 
   /* Wait for all outstanding flush operations to complete. */



Mime
View raw message