You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2015/10/29 23:30:08 UTC

svn commit: r1711374 - /subversion/trunk/subversion/libsvn_fs_x/batch_fsync.c

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. */