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/16 22:59:07 UTC

svn commit: r1434431 - in /subversion/branches/fsfs-format7/subversion/libsvn_fs_fs: cached_data.c low_level.c low_level.h

Author: stefan2
Date: Wed Jan 16 21:59:07 2013
New Revision: 1434431

URL: http://svn.apache.org/viewvc?rev=1434431&view=rev
Log:
On the fsfs-format7 branch: Use logical addressing in representations
as well and adapt the data read access function to the recent API
changes.

* subversion/libsvn_fs_fs/low_level.h
  (svn_fs_fs__rep_header_t): replace base_offset by base_item_index

* subversion/libsvn_fs_fs/low_level.c
  (svn_fs_fs__parse_representation,
   svn_fs_fs__unparse_representation): s/offset/item_index
  (svn_fs_fs__read_rep_header,
   svn_fs_fs__write_rep_header): s/base_offset/base_item_index

* subversion/libsvn_fs_fs/cached_data.c
  (open_and_seek_revision): adapt to API changes
  (open_and_seek_transaction,
   create_rep_state_body): translate item index to offset
  (open_and_seek_representation,
   svn_fs_fs__get_contents,
   svn_fs_fs__try_process_file_contents,
   svn_fs_fs__get_proplist): s/offset/item_index
  (svn_fs_fs__rev_get_root
   svn_fs_fs__get_changes): use fixed item index for format7
  (build_rep_list,
   svn_fs_fs__get_file_delta_stream): s/base_offset/base_item_index

Modified:
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.h

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c?rev=1434431&r1=1434430&r2=1434431&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c Wed Jan 16 21:59:07 2013
@@ -54,7 +54,7 @@ open_and_seek_revision(apr_file_t **file
   SVN_ERR(svn_fs_fs__ensure_revision_exists(rev, fs, pool));
 
   SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&rev_file, fs, rev, pool));
-  SVN_ERR(svn_fs_fs__item_offset(&offset, fs, rev, item, pool));
+  SVN_ERR(svn_fs_fs__item_offset(&offset, fs, rev, NULL, item, pool));
   SVN_ERR(svn_io_file_seek(rev_file, APR_SET, &offset, pool));
 
   *file = rev_file;
@@ -80,7 +80,8 @@ open_and_seek_transaction(apr_file_t **f
   SVN_ERR(svn_io_file_open(&rev_file, path_txn_proto_rev(fs, txn_id, pool),
                            APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
 
-  offset = rep->offset;
+  SVN_ERR(svn_fs_fs__item_offset(&offset, fs, SVN_INVALID_REVNUM, txn_id,
+                                 rep->item_index, pool));
   SVN_ERR(svn_io_file_seek(rev_file, APR_SET, &offset, pool));
 
   *file = rev_file;
@@ -98,7 +99,7 @@ open_and_seek_representation(apr_file_t 
                              apr_pool_t *pool)
 {
   if (! rep->txn_id)
-    return open_and_seek_revision(file_p, fs, rep->revision, rep->offset,
+    return open_and_seek_revision(file_p, fs, rep->revision, rep->item_index,
                                   pool);
   else
     return open_and_seek_transaction(file_p, fs, rep->txn_id, rep, pool);
@@ -388,8 +389,13 @@ svn_fs_fs__rev_get_root(svn_fs_id_t **ro
     return SVN_NO_ERROR;
 
   SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&revision_file, fs, rev, pool));
-  SVN_ERR(get_root_changes_offset(&root_offset, NULL, revision_file, fs, rev,
-                                  pool));
+
+  if (ffd->format < SVN_FS_FS__MIN_LOG_ADDRESSING_FORMAT)
+    SVN_ERR(get_root_changes_offset(&root_offset, NULL, revision_file,
+                                    fs, rev, pool));
+  else
+    SVN_ERR(svn_fs_fs__item_offset(&root_offset, fs, rev, NULL,
+                                   SVN_FS_FS__ITEM_INDEX_ROOT_NODE, pool));
 
   SVN_ERR(get_fs_id_at_offset(&root_id, revision_file, fs, rev,
                               root_offset, pool));
@@ -451,9 +457,8 @@ create_rep_state_body(rep_state_t **rep_
       /* ... we can re-use the same, already open file object
        */
       apr_off_t offset;
-      SVN_ERR(svn_fs_fs__get_packed_offset(&offset, fs, rep->revision, pool));
-
-      offset += rep->offset;
+      SVN_ERR(svn_fs_fs__item_offset(&offset, fs, rep->revision, NULL,
+                                     rep->item_index, pool));
       SVN_ERR(svn_io_file_seek(*file_hint, APR_SET, &offset, pool));
 
       rs->file = *file_hint;
@@ -869,7 +874,7 @@ build_rep_list(apr_array_header_t **list
         }
 
       rep.revision = rep_header->base_revision;
-      rep.offset = rep_header->base_offset;
+      rep.item_index = rep_header->base_item_index;
       rep.size = rep_header->base_length;
       rep.txn_id = NULL;
 
@@ -1256,7 +1261,7 @@ svn_fs_fs__get_contents(svn_stream_t **c
       struct rep_read_baton *rb;
 
       fulltext_cache_key.revision = rep->revision;
-      fulltext_cache_key.second = rep->offset;
+      fulltext_cache_key.second = rep->item_index;
       if (ffd->fulltext_cache && SVN_IS_VALID_REVNUM(rep->revision)
           && fulltext_size_is_cachable(ffd, len))
         {
@@ -1332,7 +1337,7 @@ svn_fs_fs__try_process_file_contents(svn
       pair_cache_key_t fulltext_cache_key;
 
       fulltext_cache_key.revision = rep->revision;
-      fulltext_cache_key.second = rep->offset;
+      fulltext_cache_key.second = rep->item_index;
       if (ffd->fulltext_cache && SVN_IS_VALID_REVNUM(rep->revision)
           && fulltext_size_is_cachable(ffd, rep->expanded_size))
         {
@@ -1412,7 +1417,7 @@ svn_fs_fs__get_file_delta_stream(svn_txd
       if (rep_header->is_delta
           && (rep_header->is_delta_vs_empty
               || (rep_header->base_revision == source->data_rep->revision
-                  && rep_header->base_offset == source->data_rep->offset)))
+                  && rep_header->base_item_index == source->data_rep->item_index)))
         {
           /* Create the delta read baton. */
           struct delta_read_baton *drb = apr_pcalloc(pool, sizeof(*drb));
@@ -1682,7 +1687,7 @@ svn_fs_fs__get_proplist(apr_hash_t **pro
       pair_cache_key_t key;
 
       key.revision = rep->revision;
-      key.second = rep->offset;
+      key.second = rep->item_index;
       if (ffd->properties_cache && SVN_IS_VALID_REVNUM(rep->revision))
         {
           svn_boolean_t is_cached;
@@ -1743,8 +1748,12 @@ svn_fs_fs__get_changes(apr_array_header_
 
   SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&revision_file, fs, rev, pool));
 
-  SVN_ERR(get_root_changes_offset(NULL, &changes_offset, revision_file, fs,
-                                  rev, pool));
+  if (ffd->format < SVN_FS_FS__MIN_LOG_ADDRESSING_FORMAT)
+    SVN_ERR(get_root_changes_offset(NULL, &changes_offset, revision_file,
+                                    fs, rev, pool));
+  else
+    SVN_ERR(svn_fs_fs__item_offset(&changes_offset, fs, rev, NULL,
+                                   SVN_FS_FS__ITEM_INDEX_CHANGES, pool));
 
   SVN_ERR(svn_io_file_seek(revision_file, APR_SET, &changes_offset, pool));
   SVN_ERR(svn_fs_fs__read_changes(changes,

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.c?rev=1434431&r1=1434430&r2=1434431&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.c Wed Jan 16 21:59:07 2013
@@ -272,7 +272,7 @@ svn_fs_fs__parse_representation(represen
     }
 
   SVN_ERR(svn_cstring_atoi64(&val, str));
-  rep->offset = (apr_off_t)val;
+  rep->item_index = (apr_off_t)val;
 
   str = svn_cstring_tokenize(" ", &string);
   if (str == NULL)
@@ -533,14 +533,14 @@ svn_fs_fs__unparse_representation(repres
     return svn_stringbuf_createf
             (pool, "%ld %" APR_OFF_T_FMT " %" SVN_FILESIZE_T_FMT
              " %" SVN_FILESIZE_T_FMT " %s",
-             rep->revision, rep->offset, rep->size,
+             rep->revision, rep->item_index, rep->size,
              rep->expanded_size,
              DISPLAY_MAYBE_NULL_CHECKSUM(rep->md5_checksum));
 
   return svn_stringbuf_createf
           (pool, "%ld %" APR_OFF_T_FMT " %" SVN_FILESIZE_T_FMT
            " %" SVN_FILESIZE_T_FMT " %s %s %s",
-           rep->revision, rep->offset, rep->size,
+           rep->revision, rep->item_index, rep->size,
            rep->expanded_size,
            DISPLAY_MAYBE_NULL_CHECKSUM(rep->md5_checksum),
            DISPLAY_MAYBE_NULL_CHECKSUM(rep->sha1_checksum),
@@ -667,7 +667,7 @@ svn_fs_fs__read_rep_header(svn_fs_fs__re
   if (! str)
     goto error;
   SVN_ERR(svn_cstring_atoi64(&val, str));
-  (*header)->base_offset = (apr_off_t)val;
+  (*header)->base_item_index = (apr_off_t)val;
 
   str = svn_cstring_tokenize(" ", &last_str);
   if (! str)
@@ -701,7 +701,7 @@ svn_fs_fs__write_rep_header(svn_fs_fs__r
     {
       text = apr_psprintf(pool, REP_DELTA " %ld %" APR_OFF_T_FMT " %"
                           SVN_FILESIZE_T_FMT "\n",
-                          header->base_revision, header->base_offset,
+                          header->base_revision, header->base_item_index,
                           header->base_length);
     }
 

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.h?rev=1434431&r1=1434430&r2=1434431&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.h Wed Jan 16 21:59:07 2013
@@ -106,9 +106,9 @@ typedef struct svn_fs_fs__rep_header_t
   svn_revnum_t base_revision;
 
   /* if this rep is a delta against some other rep, that base rep can
-   * be found at this offset within the base rep's revision.  Should be 0
-   * if there is no base rep. */
-  apr_off_t base_offset;
+   * be found at this item index within the base rep's revision.  Should
+   * be 0 if there is no base rep. */
+  apr_off_t base_item_index;
 
   /* if this rep is a delta against some other rep, this is the (deltified)
    * size of that base rep.  Should be 0 if there is no base rep. */