subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1532015 - in /subversion/branches/log-addressing/subversion/libsvn_fs_fs: fs_fs.c index.c transaction.c util.c util.h
Date Mon, 14 Oct 2013 18:31:45 GMT
Author: stefan2
Date: Mon Oct 14 18:31:45 2013
New Revision: 1532015

URL: http://svn.apache.org/r1532015
Log:
On the log-addressing branch: make the index file path calculation
require an explicit selection of packed / non-packed file path.

* subversion/libsvn_fs_fs/util.h
  (svn_fs_fs__path_l2p_index,
   svn_fs_fs__path_p2l_index): add PACKED flag to signature

* subversion/libsvn_fs_fs/util.c
  (path_rev_absolute_internal): new utility function, mostly taken
                                from svn_fs_fs__path_rev_absolute
  (svn_fs_fs__path_l2p_index,
   svn_fs_fs__path_p2l_index,
   svn_fs_fs__path_rev_absolute): re-implement using the new utility

* subversion/libsvn_fs_fs/index.c
  (auto_open_l2p_index,
   get_l2p_header_body,
   get_l2p_page,
   get_p2l_header,
   get_p2l_page,
   prefetch_p2l_page,
   p2l_index_lookup): temp. change to provide the PACKED flag to
                      the changed API.  Will ultimately provided
                      by the revision file struct

* subversion/libsvn_fs_fs/fs_fs.c
  (write_revision_zero): update API callers

* subversion/libsvn_fs_fs/transaction.c
  (commit_body): ditto

Modified:
    subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs_fs.c
    subversion/branches/log-addressing/subversion/libsvn_fs_fs/index.c
    subversion/branches/log-addressing/subversion/libsvn_fs_fs/transaction.c
    subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.c
    subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.h

Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs_fs.c?rev=1532015&r1=1532014&r2=1532015&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs_fs.c Mon Oct 14 18:31:45
2013
@@ -1119,7 +1119,7 @@ write_revision_zero(svn_fs_t *fs)
 
   if (svn_fs_fs__use_log_addressing(fs, 0))
     {
-      const char *path = svn_fs_fs__path_l2p_index(fs, 0, fs->pool);
+      const char *path = svn_fs_fs__path_l2p_index(fs, 0, FALSE, fs->pool);
       SVN_ERR(svn_io_file_create_binary
                  (path,
                   "\0\x80\x40"       /* rev 0, 8k entries per page */
@@ -1130,7 +1130,7 @@ write_revision_zero(svn_fs_t *fs)
                   fs->pool));
       SVN_ERR(svn_io_set_file_read_only(path, FALSE, fs->pool));
 
-      path = svn_fs_fs__path_p2l_index(fs, 0, fs->pool);
+      path = svn_fs_fs__path_p2l_index(fs, 0, FALSE, fs->pool);
       SVN_ERR(svn_io_file_create_binary
                  (path,
                   "\0\x6b"              /* start rev, rev file size */

Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/index.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/index.c?rev=1532015&r1=1532014&r2=1532015&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/index.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/index.c Mon Oct 14 18:31:45
2013
@@ -707,6 +707,7 @@ static svn_error_t *
 auto_open_l2p_index(svn_fs_fs__packed_number_stream_t **stream,
                     svn_fs_t *fs,
                     svn_revnum_t revision,
+                    svn_boolean_t packed,
                     apr_pool_t *pool)
 {
   if (*stream == NULL)
@@ -714,7 +715,7 @@ auto_open_l2p_index(svn_fs_fs__packed_nu
       fs_fs_data_t *ffd = fs->fsap_data;
       SVN_ERR(packed_stream_open(stream,
                                  svn_fs_fs__path_l2p_index(fs, revision,
-                                                           pool),
+                                                           packed, pool),
                                  ffd->block_size,
                                  pool));
     }
@@ -745,7 +746,7 @@ get_l2p_header_body(l2p_header_t **heade
   key.revision = base_revision(fs, revision);
   key.second = svn_fs_fs__is_packed_rev(fs, revision);
 
-  SVN_ERR(auto_open_l2p_index(stream, fs, revision, pool));
+  SVN_ERR(auto_open_l2p_index(stream, fs, revision, key.second, pool));
   packed_stream_seek(*stream, 0);
 
   /* read the table sizes */
@@ -1041,7 +1042,9 @@ get_l2p_page(l2p_page_t **page,
   apr_uint64_t last_value = 0;
 
   /* open index file and select page */
-  SVN_ERR(auto_open_l2p_index(stream, fs, start_revision, pool));
+  SVN_ERR(auto_open_l2p_index(stream, fs, start_revision,
+                              svn_fs_fs__is_packed_rev(fs, start_revision),
+                              pool));
   packed_stream_seek(*stream, table_entry->offset);
 
   /* initialize the page content */
@@ -1722,7 +1725,7 @@ get_p2l_header(p2l_header_t **header,
   if (*stream == NULL)
     SVN_ERR(packed_stream_open(stream,
                                svn_fs_fs__path_p2l_index(fs, key.revision,
-                                                         pool),
+                                                         key.second, pool),
                                ffd->block_size, stream_pool));
   else
     packed_stream_seek(*stream, 0);
@@ -1942,6 +1945,7 @@ get_p2l_page(apr_array_header_t **entrie
              svn_fs_fs__packed_number_stream_t **stream,
              svn_fs_t *fs,
              svn_revnum_t start_revision,
+             svn_boolean_t packed,
              apr_off_t start_offset,
              apr_off_t next_offset,
              apr_off_t page_start,
@@ -1962,7 +1966,7 @@ get_p2l_page(apr_array_header_t **entrie
   if (*stream == NULL)
     SVN_ERR(packed_stream_open(stream,
                                svn_fs_fs__path_p2l_index(fs, start_revision,
-                                                         pool),
+                                                         packed, pool),
                                ffd->block_size, stream_pool));
   packed_stream_seek(*stream, start_offset);
 
@@ -2060,6 +2064,7 @@ prefetch_p2l_page(svn_boolean_t *end,
   SVN_ERR(get_p2l_page(&page, stream, fs,
                        baton->first_revision,
                        baton->start_offset,
+                       key.is_packed,
                        baton->next_offset,
                        baton->page_start,
                        baton->page_size,
@@ -2178,6 +2183,7 @@ p2l_index_lookup(apr_array_header_t **en
       SVN_ERR(get_p2l_page(entries, stream, fs,
                            page_info.first_revision,
                            page_info.start_offset,
+                           key.is_packed,
                            page_info.next_offset,
                            page_info.page_start,
                            page_info.page_size, pool, pool));

Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/transaction.c?rev=1532015&r1=1532014&r2=1532015&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/transaction.c Mon Oct 14 18:31:45
2013
@@ -3294,11 +3294,11 @@ commit_body(void *baton, apr_pool_t *poo
       /* Convert the index files from the proto format into their form
          in their final location */
       SVN_ERR(svn_fs_fs__l2p_index_create(cb->fs,
-                      svn_fs_fs__path_l2p_index(cb->fs, new_rev, pool),
+                      svn_fs_fs__path_l2p_index(cb->fs, new_rev, FALSE, pool),
                       svn_fs_fs__path_l2p_proto_index(cb->fs, txn_id, pool),
                       new_rev, pool));
       SVN_ERR(svn_fs_fs__p2l_index_create(cb->fs,
-                      svn_fs_fs__path_p2l_index(cb->fs, new_rev, pool),
+                      svn_fs_fs__path_p2l_index(cb->fs, new_rev, FALSE, pool),
                       svn_fs_fs__path_p2l_proto_index(cb->fs, txn_id, pool),
                       new_rev, pool));
     }

Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.c?rev=1532015&r1=1532014&r2=1532015&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.c Mon Oct 14 18:31:45
2013
@@ -131,22 +131,39 @@ svn_fs_fs__path_rev(svn_fs_t *fs, svn_re
                               apr_psprintf(pool, "%ld", rev), NULL);
 }
 
+/* Set *PATH to the path of REV in FS with PACKED selecting whether the
+   (potential) pack file or single revision file name is returned.
+   Allocate *PATH in POOL.
+*/
+static const char *
+path_rev_absolute_internal(svn_fs_t *fs,
+                           svn_revnum_t rev,
+                           svn_boolean_t packed,
+                           apr_pool_t *pool)
+{
+  return packed
+       ? svn_fs_fs__path_rev_packed(fs, rev, PATH_PACKED, pool)
+       : svn_fs_fs__path_rev(fs, rev, pool);
+}
+
 const char *
 svn_fs_fs__path_l2p_index(svn_fs_t *fs,
                           svn_revnum_t rev,
+                          svn_boolean_t packed,
                           apr_pool_t *pool)
 {
   return apr_psprintf(pool, "%s" PATH_EXT_L2P_INDEX,
-                      svn_fs_fs__path_rev_absolute(fs, rev, pool));
+                      path_rev_absolute_internal(fs, rev, packed, pool));
 }
 
 const char *
 svn_fs_fs__path_p2l_index(svn_fs_t *fs,
                           svn_revnum_t rev,
+                          svn_boolean_t packed,
                           apr_pool_t *pool)
 {
   return apr_psprintf(pool, "%s" PATH_EXT_P2L_INDEX,
-                      svn_fs_fs__path_rev_absolute(fs, rev, pool));
+                      path_rev_absolute_internal(fs, rev, packed, pool));
 }
 
 const char *
@@ -155,11 +172,10 @@ svn_fs_fs__path_rev_absolute(svn_fs_t *f
                              apr_pool_t *pool)
 {
   fs_fs_data_t *ffd = fs->fsap_data;
+  svn_boolean_t is_packed = ffd->format >= SVN_FS_FS__MIN_PACKED_FORMAT
+                         && svn_fs_fs__is_packed_rev(fs, rev);
 
-  return (   ffd->format < SVN_FS_FS__MIN_PACKED_FORMAT
-          || ! svn_fs_fs__is_packed_rev(fs, rev))
-       ? svn_fs_fs__path_rev(fs, rev, pool)
-       : svn_fs_fs__path_rev_packed(fs, rev, PATH_PACKED, pool);
+  return path_rev_absolute_internal(fs, rev, is_packed, pool);
 }
 
 const char *

Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.h
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.h?rev=1532015&r1=1532014&r2=1532015&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.h (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.h Mon Oct 14 18:31:45
2013
@@ -175,6 +175,7 @@ svn_fs_fs__path_revprops(svn_fs_t *fs,
 const char *
 svn_fs_fs__path_l2p_index(svn_fs_t *fs,
                           svn_revnum_t rev,
+                          svn_boolean_t packed,
                           apr_pool_t *pool);
 
 /* Return the path of the file containing the phys-to-log index for the
@@ -183,6 +184,7 @@ svn_fs_fs__path_l2p_index(svn_fs_t *fs,
 const char *
 svn_fs_fs__path_p2l_index(svn_fs_t *fs,
                           svn_revnum_t rev,
+                          svn_boolean_t packed,
                           apr_pool_t *pool);
 
 /* Return the path of the file storing the oldest non-packed revision in FS.



Mime
View raw message