subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1711354 - in /subversion/trunk/subversion/libsvn_fs_x: transaction.c util.c util.h
Date Thu, 29 Oct 2015 20:09:52 GMT
Author: stefan2
Date: Thu Oct 29 20:09:52 2015
New Revision: 1711354

URL: http://svn.apache.org/viewvc?rev=1711354&view=rev
Log:
In FSX, provide a move-into-place function that supports fsync batching.

Note that svn_fs_x__move_into_place2 does not do The Right Thing on Win32
atm but that is no different from the previous state.  This will be
addressed soon.

* subversion/libsvn_fs_x/util.h
  (svn_fs_x__move_into_place2): Declare new internal API.

* subversion/libsvn_fs_x/util.c
  (svn_fs_x__move_into_place2): Implement it.

* subversion/libsvn_fs_x/transaction.c
  (bump_txn_key,
   bump_ids): Call the new batch-enabled move-into-place function.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/transaction.c
    subversion/trunk/subversion/libsvn_fs_x/util.c
    subversion/trunk/subversion/libsvn_fs_x/util.h

Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.c?rev=1711354&r1=1711353&r2=1711354&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.c Thu Oct 29 20:09:52 2015
@@ -1287,10 +1287,9 @@ bump_txn_key(svn_fs_t *fs,
 
   /* Increment the key and add a trailing \n to the string so the
      txn-current file has a newline in it. */
-  SVN_ERR(svn_io_file_rename2(txn_next_path, txn_current_path, FALSE,
-                              scratch_pool));
-  SVN_ERR(svn_fs_x__batch_fsync_new_path(batch, txn_current_path,
-                                         scratch_pool));
+  SVN_ERR(svn_fs_x__move_into_place2(txn_next_path, txn_current_path,
+                                     txn_current_path, batch,
+                                     scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -3692,10 +3691,9 @@ bump_ids(void *baton,
 
   /* Make the revision visible to all processes and threads. */
   current_filename = svn_fs_x__path_current(b->fs, scratch_pool);
-  SVN_ERR(svn_io_file_rename2(svn_fs_x__path_next(b->fs, scratch_pool),
-                              current_filename, FALSE, scratch_pool));
-  SVN_ERR(svn_fs_x__batch_fsync_new_path(b->batch, current_filename,
-                                         scratch_pool));
+  SVN_ERR(svn_fs_x__move_into_place2(svn_fs_x__path_next(b->fs, scratch_pool),
+                                     current_filename, current_filename,
+                                     b->batch, scratch_pool));
 
   /* Bump txn id. */
   SVN_ERR(bump_txn_key(b->fs, b->batch, scratch_pool));

Modified: subversion/trunk/subversion/libsvn_fs_x/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/util.c?rev=1711354&r1=1711353&r2=1711354&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/util.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/util.c Thu Oct 29 20:09:52 2015
@@ -717,6 +717,28 @@ svn_fs_x__read_number_from_stream(apr_in
 }
 
 svn_error_t *
+svn_fs_x__move_into_place2(const char *old_filename,
+                           const char *new_filename,
+                           const char *perms_reference,
+                           svn_fs_x__batch_fsync_t *batch,
+                           apr_pool_t *scratch_pool)
+{
+  /* Copying permissions is a no-op on WIN32. */
+  SVN_ERR(svn_io_copy_perms(perms_reference, old_filename, scratch_pool));
+
+  /* TODO: teach svn_fs_x__batch_fsync_t how to properly rename on Win32. */
+
+  /* Move the file into place. */
+  SVN_ERR(svn_io_file_rename2(old_filename, new_filename, FALSE,
+                              scratch_pool));
+
+  /* Schedule for synchronization. */
+  SVN_ERR(svn_fs_x__batch_fsync_new_path(batch, new_filename, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_fs_x__move_into_place(const char *old_filename,
                           const char *new_filename,
                           const char *perms_reference,

Modified: subversion/trunk/subversion/libsvn_fs_x/util.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/util.h?rev=1711354&r1=1711353&r2=1711354&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/util.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/util.h Thu Oct 29 20:09:52 2015
@@ -25,6 +25,7 @@
 
 #include "svn_fs.h"
 #include "id.h"
+#include "batch_fsync.h"
 
 /* Functions for dealing with recoverable errors on mutable files
  *
@@ -467,4 +468,13 @@ svn_fs_x__move_into_place(const char *ol
                           const char *perms_reference,
                           apr_pool_t *scratch_pool);
 
+/* Like svn_fs_x__move_into_place but schedules fsync operations in BATCH.
+   Also, OLD_FILENAME and NEW_FILENAME must point to the same volume. */
+svn_error_t *
+svn_fs_x__move_into_place2(const char *old_filename,
+                           const char *new_filename,
+                           const char *perms_reference,
+                           svn_fs_x__batch_fsync_t *batch,
+                           apr_pool_t *scratch_pool);
+
 #endif



Mime
View raw message