subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1711379 - /subversion/trunk/subversion/libsvn_fs_x/pack.c
Date Thu, 29 Oct 2015 23:14:19 GMT
Author: stefan2
Date: Thu Oct 29 23:14:19 2015
New Revision: 1711379

URL: http://svn.apache.org/viewvc?rev=1711379&view=rev
Log:
In FSX, make revision data packing code use the batch fsync infrastructure.

* subversion/libsvn_fs_x/pack.c
  (initialize_pack_context): Implicitly schedule an fsync through the BATCH.
  (close_pack_context): No need for the explicit fsync here anymore.
  (pack_log_addressed): Create the fsync batch locally and run it here.

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

Modified: subversion/trunk/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/pack.c?rev=1711379&r1=1711378&r2=1711379&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/pack.c Thu Oct 29 23:14:19 2015
@@ -244,6 +244,7 @@ initialize_pack_context(pack_context_t *
                         const char *shard_dir,
                         svn_revnum_t shard_rev,
                         int max_items,
+                        svn_fs_x__batch_fsync_t *batch,
                         svn_cancel_func_t cancel_func,
                         void *cancel_baton,
                         apr_pool_t *pool)
@@ -272,9 +273,9 @@ initialize_pack_context(pack_context_t *
   context->pack_file_dir = pack_file_dir;
   context->pack_file_path
     = svn_dirent_join(pack_file_dir, PATH_PACKED, pool);
-  SVN_ERR(svn_io_file_open(&context->pack_file, context->pack_file_path,
-                           APR_WRITE | APR_BUFFERED | APR_BINARY | APR_EXCL
-                             | APR_CREATE, APR_OS_DEFAULT, pool));
+
+  SVN_ERR(svn_fs_x__batch_fsync_open_file(&context->pack_file, batch,
+                                          context->pack_file_path, pool));
 
   /* Proto index files */
   SVN_ERR(svn_fs_x__l2p_proto_index_open(
@@ -379,10 +380,6 @@ close_pack_context(pack_context_t *conte
   SVN_ERR(svn_io_remove_file2(proto_l2p_index_path, FALSE, scratch_pool));
   SVN_ERR(svn_io_remove_file2(proto_p2l_index_path, FALSE, scratch_pool));
 
-  /* Ensure that packed file is written to disk.*/
-  SVN_ERR(svn_io_file_flush_to_disk(context->pack_file, scratch_pool));
-  SVN_ERR(svn_io_file_close(context->pack_file, scratch_pool));
-
   return SVN_NO_ERROR;
 }
 
@@ -1946,10 +1943,14 @@ pack_log_addressed(svn_fs_t *fs,
   int i;
   apr_size_t item_count = 0;
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+  svn_fs_x__batch_fsync_t *batch;
+
+  /* Perform all fsyncs through this instance. */
+  SVN_ERR(svn_fs_x__batch_fsync_create(&batch, scratch_pool));
 
   /* set up a pack context */
   SVN_ERR(initialize_pack_context(&context, fs, pack_file_dir, shard_dir,
-                                  shard_rev, max_items, cancel_func,
+                                  shard_rev, max_items, batch, cancel_func,
                                   cancel_baton, scratch_pool));
 
   /* phase 1: determine the size of the revisions to pack */
@@ -1997,6 +1998,9 @@ pack_log_addressed(svn_fs_t *fs,
   /* last phase: finalize indexes and clean up */
   SVN_ERR(reset_pack_context(&context, iterpool));
   SVN_ERR(close_pack_context(&context, iterpool));
+
+  /* Ensure that packed file is written to disk.*/
+  SVN_ERR(svn_fs_x__batch_fsync_run(batch, iterpool));
   svn_pool_destroy(iterpool);
 
   return SVN_NO_ERROR;



Mime
View raw message