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 2013/01/09 05:12:07 UTC

svn commit: r1430675 - in /subversion/branches/fsfs-format7/subversion/libsvn_fs_fs: fs.h fs_fs.c fs_fs.h revprops.c transaction.c util.c util.h

Author: stefan2
Date: Wed Jan  9 04:12:06 2013
New Revision: 1430675

URL: http://svn.apache.org/viewvc?rev=1430675&view=rev
Log:
On the fsfs-format7 branch: make svn_fs_fs__path_rev_absolute return the
path instead of error objects because there are no error conditions.
Use this simplified API to implement two new FSFS file name constructors.

* subversion/libsvn_fs_fs/fs_fs.h
  (svn_fs_fs__path_rev_absolute): return path directly
* subversion/libsvn_fs_fs/util.h
  (path_l2p_index,
   path_p2l_index): declare new path naming function

* subversion/libsvn_fs_fs/fs.h
  (PATH_EXT_L2P_INDEX,
   PATH_EXT_P2L_INDEX): define file extensions for our new index files
* subversion/libsvn_fs_fs/util.c
  (path_l2p_index,
   path_p2l_index): implement new path naming function
  (svn_fs_fs__path_rev_absolute): implement changed API

* subversion/libsvn_fs_fs/fs_fs.c
  (svn_fs_fs__open_pack_or_rev_file): update caller
* subversion/libsvn_fs_fs/revprops.c
  (set_revision_proplist): ditto
* subversion/libsvn_fs_fs/transaction.c
  (commit_body): same here

Modified:
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs_fs.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs_fs.h
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/revprops.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.h

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h?rev=1430675&r1=1430674&r2=1430675&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h Wed Jan  9 04:12:06 2013
@@ -67,6 +67,10 @@ extern "C" {
 #define PATH_PACKED           "pack"             /* Packed revision data file */
 #define PATH_EXT_PACKED_SHARD ".pack"            /* Extension for packed
                                                     shards */
+#define PATH_EXT_L2P_INDEX    ".l2p"             /* extension of the log-
+                                                    to-phys index */
+#define PATH_EXT_P2L_INDEX    ".p2l"             /* extension of the phys-
+                                                    to-log index */
 /* If you change this, look at tests/svn_test_fs.c(maybe_install_fsfs_conf) */
 #define PATH_CONFIG           "fsfs.conf"        /* Configuration */
 

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs_fs.c?rev=1430675&r1=1430674&r2=1430675&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs_fs.c Wed Jan  9 04:12:06 2013
@@ -670,18 +670,15 @@ svn_fs_fs__open_pack_or_rev_file(apr_fil
 {
   fs_fs_data_t *ffd = fs->fsap_data;
   svn_error_t *err;
-  const char *path;
   svn_boolean_t retry = FALSE;
 
   do
     {
-      err = svn_fs_fs__path_rev_absolute(&path, fs, rev, pool);
+      const char *path = svn_fs_fs__path_rev_absolute(fs, rev, pool);
 
       /* open the revision file in buffered r/o mode */
-      if (! err)
-        err = svn_io_file_open(file, path,
-                              APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool);
-
+      err = svn_io_file_open(file, path,
+                            APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool);
       if (err && APR_STATUS_IS_ENOENT(err->apr_err))
         {
           if (ffd->format >= SVN_FS_FS__MIN_PACKED_FORMAT)

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs_fs.h?rev=1430675&r1=1430674&r2=1430675&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs_fs.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs_fs.h Wed Jan  9 04:12:06 2013
@@ -134,9 +134,8 @@ svn_error_t *svn_fs_fs__set_uuid(svn_fs_
    returns, because the revision might become packed before or after this
    call.  If a file exists at that path, then it is correct; if not, then
    the caller should call update_min_unpacked_rev() and re-try once. */
-svn_error_t *
-svn_fs_fs__path_rev_absolute(const char **path,
-                             svn_fs_t *fs,
+const char *
+svn_fs_fs__path_rev_absolute(svn_fs_t *fs,
                              svn_revnum_t rev,
                              apr_pool_t *pool);
 

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/revprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/revprops.c?rev=1430675&r1=1430674&r2=1430675&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/revprops.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/revprops.c Wed Jan  9 04:12:06 2013
@@ -1374,7 +1374,7 @@ set_revision_proplist(svn_fs_t *fs,
    * file won't exist and therefore can't serve as its own reference.
    * (Whereas the rev file should already exist at this point.)
    */
-  SVN_ERR(svn_fs_fs__path_rev_absolute(&perms_reference, fs, rev, pool));
+  perms_reference = svn_fs_fs__path_rev_absolute(fs, rev, pool);
 
   /* Now, switch to the new revprop data. */
   SVN_ERR(switch_to_new_revprop(fs, final_path, tmp_path, perms_reference,

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c?rev=1430675&r1=1430674&r2=1430675&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c Wed Jan  9 04:12:06 2013
@@ -2904,8 +2904,8 @@ commit_body(void *baton, apr_pool_t *poo
     }
 
   /* Move the finished rev file into place. */
-  SVN_ERR(svn_fs_fs__path_rev_absolute(&old_rev_filename,
-                                       cb->fs, old_rev, pool));
+  old_rev_filename = svn_fs_fs__path_rev_absolute(cb->fs, old_rev, pool);
+
   rev_filename = path_rev(cb->fs, new_rev, pool);
   proto_filename = path_txn_proto_rev(cb->fs, cb->txn->id, pool);
   SVN_ERR(move_into_place(proto_filename, rev_filename, old_rev_filename,

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.c?rev=1430675&r1=1430674&r2=1430675&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.c Wed Jan  9 04:12:06 2013
@@ -159,25 +159,35 @@ path_rev(svn_fs_t *fs, svn_revnum_t rev,
                               apr_psprintf(pool, "%ld", rev), NULL);
 }
 
-svn_error_t *
-svn_fs_fs__path_rev_absolute(const char **path,
-                             svn_fs_t *fs,
+const char *
+path_l2p_index(svn_fs_t *fs,
+               svn_revnum_t rev,
+               apr_pool_t *pool)
+{
+  return apr_psprintf(pool, "%s" PATH_EXT_L2P_INDEX,
+                      svn_fs_fs__path_rev_absolute(fs, rev, pool));
+}
+
+const char *
+path_p2l_index(svn_fs_t *fs,
+               svn_revnum_t rev,
+               apr_pool_t *pool)
+{
+  return apr_psprintf(pool, "%s" PATH_EXT_P2L_INDEX,
+                      svn_fs_fs__path_rev_absolute(fs, rev, pool));
+}
+
+const char *
+svn_fs_fs__path_rev_absolute(svn_fs_t *fs,
                              svn_revnum_t rev,
                              apr_pool_t *pool)
 {
   fs_fs_data_t *ffd = fs->fsap_data;
 
-  if (ffd->format < SVN_FS_FS__MIN_PACKED_FORMAT
-      || ! is_packed_rev(fs, rev))
-    {
-      *path = path_rev(fs, rev, pool);
-    }
-  else
-    {
-      *path = path_rev_packed(fs, rev, PATH_PACKED, pool);
-    }
-
-  return SVN_NO_ERROR;
+  return (   ffd->format < SVN_FS_FS__MIN_PACKED_FORMAT
+          || ! is_packed_rev(fs, rev))
+       ? path_rev(fs, rev, pool)
+       : path_rev_packed(fs, rev, PATH_PACKED, pool);
 }
 
 const char *

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.h?rev=1430675&r1=1430674&r2=1430675&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.h Wed Jan  9 04:12:06 2013
@@ -118,6 +118,16 @@ path_rev(svn_fs_t *fs,
          apr_pool_t *pool);
 
 const char *
+path_l2p_index(svn_fs_t *fs,
+               svn_revnum_t rev,
+               apr_pool_t *pool);
+
+const char *
+path_p2l_index(svn_fs_t *fs,
+               svn_revnum_t rev,
+               apr_pool_t *pool);
+
+const char *
 path_revprops_shard(svn_fs_t *fs,
                     svn_revnum_t rev,
                     apr_pool_t *pool);