subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1503789 - in /subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs: fs_fs.c fs_fs.h util.c util.h
Date Tue, 16 Jul 2013 16:34:14 GMT
Author: stefan2
Date: Tue Jul 16 16:34:14 2013
New Revision: 1503789

URL: http://svn.apache.org/r1503789
Log:
On the fsfs-improvements branch:  Move path getters for some global
FSFS files from fs_fs.c to utils.*.

Also, publish the write_format function and simplify its signature.

* subversion/libsvn_fs_fs/util.h
  (svn_fs_fs__path_txn_current,
   svn_fs_fs__path_txn_current_lock,
   svn_fs_fs__path_lock): declare new private API

* subversion/libsvn_fs_fs/util.c
  (svn_fs_fs__path_txn_current,
   svn_fs_fs__path_txn_current_lock,
   svn_fs_fs__path_lock): implement with code taken from fs_fs.c

* subversion/libsvn_fs_fs/fs_fs.h
  (svn_fs_fs__write_format): declare write_format as a new private API

* subversion/libsvn_fs_fs/fs_fs.c
  (path_txn_current,
   path_txn_current_lock,
   path_lock): moved to utils.c
  (write_format): rename; shorten signature and update implementation
  (upgrade_body,
   svn_fs_fs__create,
   hotcopy_body): update callers

Modified:
    subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c
    subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.h
    subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.c
    subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.h

Modified: subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c?rev=1503789&r1=1503788&r2=1503789&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c Tue Jul 16 16:34:14
2013
@@ -792,21 +792,25 @@ read_format(int *pformat, int *max_files
    previously existing file.
 
    Use POOL for temporary allocation. */
-static svn_error_t *
-write_format(const char *path, int format, int max_files_per_dir,
-             svn_boolean_t overwrite, apr_pool_t *pool)
+svn_error_t *
+svn_fs_fs__write_format(svn_fs_t *fs,
+                        svn_boolean_t overwrite,
+                        apr_pool_t *pool)
 {
   svn_stringbuf_t *sb;
+  fs_fs_data_t *ffd = fs->fsap_data;
+  const char *path = path_format(fs, pool);
 
-  SVN_ERR_ASSERT(1 <= format && format <= SVN_FS_FS__FORMAT_NUMBER);
+  SVN_ERR_ASSERT(1 <= ffd->format
+                 && ffd->format <= SVN_FS_FS__FORMAT_NUMBER);
 
-  sb = svn_stringbuf_createf(pool, "%d\n", format);
+  sb = svn_stringbuf_createf(pool, "%d\n", ffd->format);
 
-  if (format >= SVN_FS_FS__MIN_LAYOUT_FORMAT_OPTION_FORMAT)
+  if (ffd->format >= SVN_FS_FS__MIN_LAYOUT_FORMAT_OPTION_FORMAT)
     {
-      if (max_files_per_dir)
+      if (ffd->max_files_per_dir)
         svn_stringbuf_appendcstr(sb, apr_psprintf(pool, "layout sharded %d\n",
-                                                  max_files_per_dir));
+                                                  ffd->max_files_per_dir));
       else
         svn_stringbuf_appendcstr(sb, "layout linear\n");
     }
@@ -1142,6 +1146,7 @@ upgrade_body(void *baton, apr_pool_t *po
 {
   struct upgrade_baton_t *upgrade_baton = baton;
   svn_fs_t *fs = upgrade_baton->fs;
+  fs_fs_data_t *ffd = fs->fsap_data;
   int format, max_files_per_dir;
   const char *format_path = path_format(fs, pool);
   svn_node_kind_t kind;
@@ -1216,8 +1221,9 @@ upgrade_body(void *baton, apr_pool_t *po
     }
 
   /* Bump the format file. */
-  SVN_ERR(write_format(format_path, SVN_FS_FS__FORMAT_NUMBER,
-                       max_files_per_dir, TRUE, pool));
+  ffd->format = SVN_FS_FS__FORMAT_NUMBER;
+  ffd->max_files_per_dir = max_files_per_dir;
+  SVN_ERR(svn_fs_fs__write_format(fs, TRUE, pool));
   if (upgrade_baton->notify_func)
     SVN_ERR(upgrade_baton->notify_func(upgrade_baton->notify_baton,
                                        SVN_FS_FS__FORMAT_NUMBER,
@@ -4158,8 +4164,7 @@ svn_fs_fs__create(svn_fs_t *fs,
     }
 
   /* This filesystem is ready.  Stamp it with a format number. */
-  SVN_ERR(write_format(path_format(fs, pool),
-                       ffd->format, ffd->max_files_per_dir, FALSE, pool));
+  SVN_ERR(svn_fs_fs__write_format(fs,FALSE, pool));
 
   ffd->youngest_rev_cache = 0;
   return SVN_NO_ERROR;
@@ -5440,8 +5445,8 @@ hotcopy_body(void *baton, apr_pool_t *po
   SVN_ERR(svn_fs_fs__cleanup_revprop_namespace(dst_fs));
 
   /* Hotcopied FS is complete. Stamp it with a format file. */
-  SVN_ERR(write_format(svn_dirent_join(dst_fs->path, PATH_FORMAT, pool),
-                       dst_ffd->format, max_files_per_dir, TRUE, pool));
+  dst_ffd->max_files_per_dir = max_files_per_dir;
+  SVN_ERR(svn_fs_fs__write_format(dst_fs, TRUE, pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.h?rev=1503789&r1=1503788&r2=1503789&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.h (original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.h Tue Jul 16 16:34:14
2013
@@ -309,6 +309,15 @@ svn_error_t *svn_fs_fs__txn_changes_fetc
 const char *
 svn_fs_fs__path_current(svn_fs_t *fs, apr_pool_t *pool);
 
+/* Write the format number and maximum number of files per directory
+   for FS, possibly expecting to overwrite a previously existing file.
+
+   Use POOL for temporary allocation. */
+svn_error_t *
+svn_fs_fs__write_format(svn_fs_t *fs,
+                        svn_boolean_t overwrite,
+                        apr_pool_t *pool);
+
 /* Obtain a write lock on the filesystem FS in a subpool of POOL, call
    BODY with BATON and that subpool, destroy the subpool (releasing the write
    lock) and return what BODY returned. */

Modified: subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.c?rev=1503789&r1=1503788&r2=1503789&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.c (original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.c Tue Jul 16 16:34:14
2013
@@ -55,6 +55,27 @@ svn_fs_fs__is_packed_revprop(svn_fs_t *f
 }
 
 const char *
+svn_fs_fs__path_txn_current(svn_fs_t *fs,
+                            apr_pool_t *pool)
+{
+  return svn_dirent_join(fs->path, PATH_TXN_CURRENT, pool);
+}
+
+const char *
+svn_fs_fs__path_txn_current_lock(svn_fs_t *fs,
+                                 apr_pool_t *pool)
+{
+  return svn_dirent_join(fs->path, PATH_TXN_CURRENT_LOCK, pool);
+}
+
+const char *
+svn_fs_fs__path_lock(svn_fs_t *fs,
+                     apr_pool_t *pool)
+{
+  return svn_dirent_join(fs->path, PATH_LOCK_FILE, pool);
+}
+
+const char *
 svn_fs_fs__path_revprop_generation(svn_fs_t *fs,
                                    apr_pool_t *pool)
 {

Modified: subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.h?rev=1503789&r1=1503788&r2=1503789&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.h (original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/util.h Tue Jul 16 16:34:14
2013
@@ -102,6 +102,27 @@ svn_fs_fs__path_rev_packed(svn_fs_t *fs,
                            const char *kind,
                            apr_pool_t *pool);
 
+/* Return the full path of the "txn-current" file in FS.
+ * The result will be allocated in POOL.
+ */
+const char *
+svn_fs_fs__path_txn_current(svn_fs_t *fs,
+                            apr_pool_t *pool);
+
+/* Return the full path of the "txn-current-lock" file in FS.
+ * The result will be allocated in POOL.
+ */
+const char *
+svn_fs_fs__path_txn_current_lock(svn_fs_t *fs,
+                                 apr_pool_t *pool);
+
+/* Return the full path of the global write lock file in FS.
+ * The result will be allocated in POOL.
+ */
+const char *
+svn_fs_fs__path_lock(svn_fs_t *fs,
+                     apr_pool_t *pool);
+
 /* Return the full path of the revprop generation file in FS.
  * Allocate the result in POOL.
  */



Mime
View raw message