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 2014/02/16 18:06:00 UTC

svn commit: r1568792 - in /subversion/trunk/subversion/libsvn_fs_x: cached_data.c fs.h fs_x.c low_level.c noderevs.c pack.c rep-cache.c reps.c transaction.c verify.c

Author: stefan2
Date: Sun Feb 16 17:05:59 2014
New Revision: 1568792

URL: http://svn.apache.org/r1568792
Log:
In FSX, replace the txn_id / rev+item members in representation_t with
a single change set based id part.

Most of the code churn is simply adding / removing conversions between
the old dual representation and the new change set based struct.

* subversion/libsvn_fs_x/fs.h
  (representation_t): Replace the txn/rev dual members with the unified
                      ID part struct.

* subversion/libsvn_fs_x/fs_x.c
  (svn_fs_x__noderev_same_rep_key): Simplify based on the unified struct.

* subversion/libsvn_fs_x/low_level.c
  (svn_fs_x__parse_representation,
   read_rep_offsets,
   svn_fs_x__unparse_representation): Update representation_t struct access
                                      and remove txn special casing.

* subversion/libsvn_fs_x/noderevs.c
  (binary_representation_t): Switch the container-internal representation
                             to change set based id part as well.
  (store_representation,
   get_representation,
   write_reps,
   read_reps): Update struct accessors and conversions.

* subversion/libsvn_fs_x/cached_data.c
  (open_and_seek_transaction,
   open_and_seek_representation,
   create_rep_state_body,
   svn_fs_x__rep_chain_length,
   build_rep_list,
   svn_fs_x__get_contents,
   svn_fs_x__try_process_file_contents,
   get_dir_contents,
   locate_dir_cache,
   svn_fs_x__get_proplist): Update representation_t struct access and
                            ID conversion.

* subversion/libsvn_fs_x/pack.c
  (copy_node_to_temp,
   write_reps_containers): Ditto.

* subversion/libsvn_fs_x/reps.c
  (svn_fs_x__reps_add_base): Same.

* subversion/libsvn_fs_x/rep-cache.c
  (rep_has_been_born,
   svn_fs_x__walk_rep_reference,
   svn_fs_x__get_rep_reference, 
   svn_fs_x__set_rep_reference): Same. 

* subversion/libsvn_fs_x/transaction.c
  (store_sha1_rep_mapping,
   svn_fs_x__set_entry,
   choose_delta_base,
   rep_write_get_baton,
   get_shared_rep,
   rep_write_contents_close,
   svn_fs_x__set_proplist,
   write_hash_delta_rep,
   write_final_rev,
   svn_fs_x__delete_node_revision): Ditto

* subversion/libsvn_fs_x/verify.c
  (verify_walker): Ditto.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/cached_data.c
    subversion/trunk/subversion/libsvn_fs_x/fs.h
    subversion/trunk/subversion/libsvn_fs_x/fs_x.c
    subversion/trunk/subversion/libsvn_fs_x/low_level.c
    subversion/trunk/subversion/libsvn_fs_x/noderevs.c
    subversion/trunk/subversion/libsvn_fs_x/pack.c
    subversion/trunk/subversion/libsvn_fs_x/rep-cache.c
    subversion/trunk/subversion/libsvn_fs_x/reps.c
    subversion/trunk/subversion/libsvn_fs_x/transaction.c
    subversion/trunk/subversion/libsvn_fs_x/verify.c

Modified: subversion/trunk/subversion/libsvn_fs_x/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/cached_data.c?rev=1568792&r1=1568791&r2=1568792&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/cached_data.c Sun Feb 16 17:05:59 2014
@@ -219,17 +219,13 @@ open_and_seek_transaction(apr_file_t **f
   apr_file_t *rev_file;
   apr_off_t offset;
   apr_uint32_t sub_item = 0;
-
-  svn_fs_x__id_part_t id;
-  id.change_set = svn_fs_x__change_set_by_txn(rep->txn_id);
-  id.number = rep->item_index;
+  apr_int64_t txn_id = svn_fs_x__get_txn_id(rep->id.change_set);
 
   SVN_ERR(svn_io_file_open(&rev_file,
-                           svn_fs_x__path_txn_proto_rev(fs, rep->txn_id,
-                                                        pool),
+                           svn_fs_x__path_txn_proto_rev(fs, txn_id, pool),
                            APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
 
-  SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, &id, pool));
+  SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, &rep->id, pool));
   SVN_ERR(aligned_seek(fs, rev_file, NULL, offset, pool));
 
   *file = rev_file;
@@ -246,13 +242,8 @@ open_and_seek_representation(apr_file_t 
                              representation_t *rep,
                              apr_pool_t *pool)
 {
-  if (! svn_fs_x__id_txn_used(rep->txn_id))
-    {
-      svn_fs_x__id_part_t id;
-      id.change_set = svn_fs_x__change_set_by_rev(rep->revision);
-      id.number = rep->item_index;
-      return open_and_seek_revision(file_p, fs, &id, pool);
-    }
+  if (svn_fs_x__is_revision(rep->id.change_set))
+    return open_and_seek_revision(file_p, fs, &rep->id, pool);
   else
     return open_and_seek_transaction(file_p, fs, rep, pool);
 }
@@ -516,6 +507,7 @@ create_rep_state_body(rep_state_t **rep_
   rep_state_t *rs = apr_pcalloc(pool, sizeof(*rs));
   svn_fs_x__rep_header_t *rh;
   svn_boolean_t is_cached = FALSE;
+  svn_revnum_t revision = svn_fs_x__get_revnum(rep->id.change_set);
 
   /* If the hint is
    * - given,
@@ -529,25 +521,24 @@ create_rep_state_body(rep_state_t **rep_
     =    shared_file && *shared_file && (*shared_file)->file
       && SVN_IS_VALID_REVNUM((*shared_file)->revision)
       && (*shared_file)->revision < ffd->min_unpacked_rev
-      && rep->revision < ffd->min_unpacked_rev
+      && revision < ffd->min_unpacked_rev
       && (   ((*shared_file)->revision / ffd->max_files_per_dir)
-          == (rep->revision / ffd->max_files_per_dir));
+          == (revision / ffd->max_files_per_dir));
 
   representation_cache_key_t key;
-  key.revision = rep->revision;
-  key.is_packed = rep->revision < ffd->min_unpacked_rev;
-  key.item_index = rep->item_index;
+  key.revision = revision;
+  key.is_packed = revision < ffd->min_unpacked_rev;
+  key.item_index = rep->id.number;
 
   /* continue constructing RS and RA */
   rs->size = rep->size;
-  rs->rep_id.change_set = svn_fs_x__change_set_by_rev(rep->revision);
-  rs->rep_id.number = rep->item_index;
+  rs->rep_id = rep->id;
   rs->window_cache = ffd->txdelta_window_cache;
   rs->combined_cache = ffd->combined_window_cache;
   rs->ver = -1;
   rs->start = -1;
 
-  if (ffd->rep_header_cache && !svn_fs_x__id_txn_used(rep->txn_id))
+  if (ffd->rep_header_cache && SVN_IS_VALID_REVNUM(revision))
     SVN_ERR(svn_cache__get((void **) &rh, &is_cached,
                            ffd->rep_header_cache, &key, pool));
 
@@ -560,7 +551,9 @@ create_rep_state_body(rep_state_t **rep_
       else
         {
           shared_file_t *file = apr_pcalloc(pool, sizeof(*file));
-          file->revision = rep->revision;
+          SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision));
+
+          file->revision = revision;
           file->pool = pool;
           file->fs = fs;
           rs->file = file;
@@ -576,18 +569,17 @@ create_rep_state_body(rep_state_t **rep_
       apr_off_t offset;
       apr_uint32_t sub_item;
 
-      if (! svn_fs_x__id_txn_used(rep->txn_id))
-        SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, &rs->rep_id,
-                                      pool));
+      if (SVN_IS_VALID_REVNUM(revision))
+        SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, &rep->id, pool));
 
       /* is rep stored in some star-deltified container? */
-      if (! svn_fs_x__id_txn_used(rep->txn_id))
+      if (SVN_IS_VALID_REVNUM(revision))
         {
           svn_boolean_t in_container = TRUE;
           if (sub_item == 0)
             {
               svn_fs_x__p2l_entry_t *entry;
-              SVN_ERR(svn_fs_x__p2l_entry_lookup(&entry, fs, rep->revision,
+              SVN_ERR(svn_fs_x__p2l_entry_lookup(&entry, fs, revision,
                                                  offset, pool));
               in_container = entry->type == SVN_FS_X__ITEM_TYPE_REPS_CONT;
             }
@@ -600,7 +592,7 @@ create_rep_state_body(rep_state_t **rep_
 
               /* provide an empty shared file struct */
               rs->file = apr_pcalloc(pool, sizeof(*rs->file));
-              rs->file->revision = rep->revision;
+              rs->file->revision = revision;
               rs->file->pool = pool;
               rs->file->fs = fs;
 
@@ -622,7 +614,7 @@ create_rep_state_body(rep_state_t **rep_
       else
         {
           shared_file_t *file = apr_pcalloc(pool, sizeof(*file));
-          file->revision = rep->revision;
+          file->revision = revision;
           file->pool = pool;
           file->fs = fs;
 
@@ -641,7 +633,7 @@ create_rep_state_body(rep_state_t **rep_
       SVN_ERR(svn_fs_x__read_rep_header(&rh, rs->file->stream, pool));
       SVN_ERR(svn_fs_x__get_file_offset(&rs->start, rs->file->file, pool));
 
-      if (! svn_fs_x__id_txn_used(rep->txn_id))
+      if (SVN_IS_VALID_REVNUM(revision))
         {
           SVN_ERR(block_read(NULL, fs, &rs->rep_id, rs->file->file, pool, pool));
           if (ffd->rep_header_cache)
@@ -756,10 +748,10 @@ svn_fs_x__rep_chain_length(int *chain_le
                                     fs,
                                     sub_pool));
 
-      base_rep.revision = header->base_revision;
-      base_rep.item_index = header->base_item_index;
+      base_rep.id.change_set
+        = svn_fs_x__change_set_by_rev(header->base_revision);
+      base_rep.id.number = header->base_item_index;
       base_rep.size = header->base_length;
-      svn_fs_x__id_txn_reset(&base_rep.txn_id);
       is_delta = header->type == svn_fs_x__rep_delta;
 
       ++count;
@@ -769,7 +761,7 @@ svn_fs_x__rep_chain_length(int *chain_le
           svn_pool_clear(sub_pool);
         }
     }
-  while (is_delta && base_rep.revision);
+  while (is_delta && base_rep.id.change_set);
 
   *chain_length = count;
   svn_pool_destroy(sub_pool);
@@ -1082,7 +1074,7 @@ build_rep_list(apr_array_header_t **list
 
       /* for txn reps and containered reps, there won't be a cached
        * combined window */
-      if (!svn_fs_x__id_txn_used(rep.txn_id)
+      if (svn_fs_x__is_revision(rep.id.change_set)
           && rep_header->type != svn_fs_x__rep_container)
         SVN_ERR(get_cached_combined_window(window_p, rs, &is_cached, pool));
 
@@ -1112,10 +1104,10 @@ build_rep_list(apr_array_header_t **list
           return SVN_NO_ERROR;
         }
 
-      rep.revision = rep_header->base_revision;
-      rep.item_index = rep_header->base_item_index;
+      rep.id.change_set
+        = svn_fs_x__change_set_by_rev(rep_header->base_revision);
+      rep.id.number = rep_header->base_item_index;
       rep.size = rep_header->base_length;
-      svn_fs_x__id_txn_reset(&rep.txn_id);
 
       rs = NULL;
     }
@@ -1793,10 +1785,11 @@ svn_fs_x__get_contents(svn_stream_t **co
       pair_cache_key_t fulltext_cache_key = { 0 };
       svn_filesize_t len = rep->expanded_size;
       struct rep_read_baton *rb;
+      svn_revnum_t revision = svn_fs_x__get_revnum(rep->id.change_set);
 
-      fulltext_cache_key.revision = rep->revision;
-      fulltext_cache_key.second = rep->item_index;
-      if (ffd->fulltext_cache && SVN_IS_VALID_REVNUM(rep->revision)
+      fulltext_cache_key.revision = revision;
+      fulltext_cache_key.second = rep->id.number;
+      if (ffd->fulltext_cache && SVN_IS_VALID_REVNUM(revision)
           && fulltext_size_is_cachable(ffd, len))
         {
           svn_stringbuf_t *fulltext;
@@ -1871,9 +1864,10 @@ svn_fs_x__try_process_file_contents(svn_
       fs_x_data_t *ffd = fs->fsap_data;
       pair_cache_key_t fulltext_cache_key = { 0 };
 
-      fulltext_cache_key.revision = rep->revision;
-      fulltext_cache_key.second = rep->item_index;
-      if (ffd->fulltext_cache && SVN_IS_VALID_REVNUM(rep->revision)
+      fulltext_cache_key.revision = svn_fs_x__get_revnum(rep->id.change_set);
+      fulltext_cache_key.second = rep->id.number;
+      if (ffd->fulltext_cache
+          && SVN_IS_VALID_REVNUM(fulltext_cache_key.revision)
           && fulltext_size_is_cachable(ffd, rep->expanded_size))
         {
           cache_access_wrapper_baton_t wrapper_baton;
@@ -1937,7 +1931,8 @@ get_dir_contents(apr_hash_t *entries,
 {
   svn_stream_t *contents;
 
-  if (noderev->data_rep && svn_fs_x__id_txn_used(noderev->data_rep->txn_id))
+  if (noderev->data_rep
+      && ! svn_fs_x__is_revision(noderev->data_rep->id.change_set))
     {
       const char *filename
         = svn_fs_x__path_txn_node_children(fs, noderev->id, pool);
@@ -2061,8 +2056,9 @@ locate_dir_cache(svn_fs_t *fs,
       /* committed data can use simple rev,item pairs */
       if (noderev->data_rep)
         {
-          pair_key->revision = noderev->data_rep->revision;
-          pair_key->second = noderev->data_rep->item_index;
+          pair_key->revision
+            = svn_fs_x__get_revnum(noderev->data_rep->id.change_set);
+          pair_key->second = noderev->data_rep->id.number;
           *key = pair_key;
         }
       else
@@ -2175,7 +2171,8 @@ svn_fs_x__get_proplist(apr_hash_t **prop
   apr_hash_t *proplist;
   svn_stream_t *stream;
 
-  if (noderev->prop_rep && svn_fs_x__id_txn_used(noderev->prop_rep->txn_id))
+  if (noderev->prop_rep
+      && !svn_fs_x__is_revision(noderev->prop_rep->id.change_set))
     {
       const char *filename
         = svn_fs_x__path_txn_node_props(fs, noderev->id, pool);
@@ -2191,9 +2188,9 @@ svn_fs_x__get_proplist(apr_hash_t **prop
       representation_t *rep = noderev->prop_rep;
       pair_cache_key_t key = { 0 };
 
-      key.revision = rep->revision;
-      key.second = rep->item_index;
-      if (ffd->properties_cache && SVN_IS_VALID_REVNUM(rep->revision))
+      key.revision = svn_fs_x__get_revnum(rep->id.change_set);
+      key.second = rep->id.number;
+      if (ffd->properties_cache && SVN_IS_VALID_REVNUM(key.revision))
         {
           svn_boolean_t is_cached;
           SVN_ERR(svn_cache__get((void **) proplist_p, &is_cached,
@@ -2207,7 +2204,7 @@ svn_fs_x__get_proplist(apr_hash_t **prop
       SVN_ERR(svn_hash_read2(proplist, stream, SVN_HASH_TERMINATOR, pool));
       SVN_ERR(svn_stream_close(stream));
 
-      if (ffd->properties_cache && SVN_IS_VALID_REVNUM(rep->revision))
+      if (ffd->properties_cache && SVN_IS_VALID_REVNUM(rep->id.change_set))
         SVN_ERR(svn_cache__set(ffd->properties_cache, &key, proplist, pool));
     }
   else

Modified: subversion/trunk/subversion/libsvn_fs_x/fs.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs.h?rev=1568792&r1=1568791&r2=1568792&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs.h Sun Feb 16 17:05:59 2014
@@ -448,11 +448,8 @@ typedef struct representation_t
   unsigned char sha1_digest[APR_SHA1_DIGESTSIZE];
   unsigned char md5_digest[APR_MD5_DIGESTSIZE];
 
-  /* Revision where this representation is located. */
-  svn_revnum_t revision;
-
-  /* Item index with the the revision. */
-  apr_uint64_t item_index;
+  /* Change set and item number where this representation is located. */
+  svn_fs_x__id_part_t id;
 
   /* The size of the representation in bytes as seen in the revision
      file. */
@@ -461,9 +458,6 @@ typedef struct representation_t
   /* The size of the fulltext of the representation. */
   svn_filesize_t expanded_size;
 
-  /* Is this representation a transaction? */
-  svn_fs_x__txn_id_t txn_id;
-
 } representation_t;
 
 

Modified: subversion/trunk/subversion/libsvn_fs_x/fs_x.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs_x.c?rev=1568792&r1=1568791&r2=1568792&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs_x.c Sun Feb 16 17:05:59 2014
@@ -647,10 +647,7 @@ svn_fs_x__noderev_same_rep_key(represent
   if (a == NULL || b == NULL)
     return FALSE;
 
-  if (a->item_index != b->item_index)
-    return FALSE;
-
-  return a->revision == b->revision;
+  return svn_fs_x__id_part_eq(&a->id, &b->id);
 }
 
 svn_error_t *

Modified: subversion/trunk/subversion/libsvn_fs_x/low_level.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/low_level.c?rev=1568792&r1=1568791&r2=1568792&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/low_level.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/low_level.c Sun Feb 16 17:05:59 2014
@@ -241,17 +241,16 @@ svn_fs_x__parse_representation(represent
     return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                             _("Malformed text representation offset line in node-rev"));
 
+  SVN_ERR(svn_cstring_atoi64(&rep->id.change_set, str));
 
-  rep->revision = SVN_STR_TO_REV(str);
-
-  /* initialize transaction info (never stored) */
-  svn_fs_x__id_txn_reset(&rep->txn_id);
-  
   /* while in transactions, it is legal to simply write "-1" */
+  if (rep->id.change_set == -1)
+    return SVN_NO_ERROR;
+
   str = svn_cstring_tokenize(" ", &string);
   if (str == NULL)
     {
-      if (rep->revision == SVN_INVALID_REVNUM)
+      if (rep->id.change_set == SVN_FS_X__INVALID_CHANGE_SET)
         return SVN_NO_ERROR;
 
       return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
@@ -259,7 +258,7 @@ svn_fs_x__parse_representation(represent
     }
 
   SVN_ERR(svn_cstring_atoi64(&val, str));
-  rep->item_index = (apr_off_t)val;
+  rep->id.number = (apr_off_t)val;
 
   str = svn_cstring_tokenize(" ", &string);
   if (str == NULL)
@@ -329,10 +328,6 @@ read_rep_offsets(representation_t **rep_
       return svn_error_quick_wrap(err, where);
     }
 
-  if ((*rep_p)->revision == SVN_INVALID_REVNUM)
-    if (noderev_id)
-      (*rep_p)->txn_id = svn_fs_x__id_txn_id(noderev_id);
-
   return SVN_NO_ERROR;
 }
 
@@ -566,21 +561,18 @@ svn_fs_x__unparse_representation(represe
                                  svn_boolean_t mutable_rep_truncated,
                                  apr_pool_t *pool)
 {
-  if (svn_fs_x__id_txn_used(rep->txn_id) && mutable_rep_truncated)
-    return svn_stringbuf_ncreate("-1", 2, pool);
-
   if (!rep->has_sha1)
     return svn_stringbuf_createf
-            (pool, "%ld %" APR_OFF_T_FMT " %" SVN_FILESIZE_T_FMT
+            (pool, "%ld %" APR_INT64_T_FMT " %" SVN_FILESIZE_T_FMT
              " %" SVN_FILESIZE_T_FMT " %s",
-             rep->revision, rep->item_index, rep->size,
+             rep->id.change_set, rep->id.number, rep->size,
              rep->expanded_size,
              format_digest(rep->md5_digest, svn_checksum_md5, FALSE, pool));
 
   return svn_stringbuf_createf
-          (pool, "%ld %" APR_OFF_T_FMT " %" SVN_FILESIZE_T_FMT
+          (pool, "%ld %" APR_INT64_T_FMT " %" SVN_FILESIZE_T_FMT
            " %" SVN_FILESIZE_T_FMT " %s %s",
-           rep->revision, rep->item_index, rep->size,
+           rep->id.change_set, rep->id.number, rep->size,
            rep->expanded_size,
            format_digest(rep->md5_digest, svn_checksum_md5, FALSE, pool),
            format_digest(rep->sha1_digest, svn_checksum_sha1,

Modified: subversion/trunk/subversion/libsvn_fs_x/noderevs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/noderevs.c?rev=1568792&r1=1568791&r2=1568792&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/noderevs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/noderevs.c Sun Feb 16 17:05:59 2014
@@ -71,11 +71,8 @@ typedef struct binary_representation_t
   unsigned char sha1_digest[APR_SHA1_DIGESTSIZE];
   unsigned char md5_digest[APR_MD5_DIGESTSIZE];
 
-  /* Revision where this representation is located. */
-  svn_revnum_t revision;
-
-  /* Item index with the the revision. */
-  apr_uint64_t item_index;
+  /* Location of this representation. */
+  svn_fs_x__id_part_t id;
 
   /* The size of the representation in bytes as seen in the revision
      file. */
@@ -250,8 +247,7 @@ store_representation(apr_array_header_t 
   binary_rep.has_sha1 = rep->has_sha1;
   memcpy(binary_rep.sha1_digest, rep->sha1_digest, sizeof(rep->sha1_digest));
   memcpy(binary_rep.md5_digest, rep->md5_digest, sizeof(rep->md5_digest));
-  binary_rep.revision = rep->revision;
-  binary_rep.item_index = rep->item_index;
+  binary_rep.id = rep->id;
   binary_rep.size = rep->size;
   binary_rep.expanded_size = rep->expanded_size;
 
@@ -415,11 +411,9 @@ get_representation(representation_t **re
          sizeof((*rep)->sha1_digest));
   memcpy((*rep)->md5_digest, binary_rep->md5_digest,
          sizeof((*rep)->md5_digest));
-  (*rep)->revision = binary_rep->revision;
-  (*rep)->item_index = binary_rep->item_index;
+  (*rep)->id = binary_rep->id;
   (*rep)->size = binary_rep->size;
   (*rep)->expanded_size = binary_rep->expanded_size;
-  svn_fs_x__id_txn_reset(&(*rep)->txn_id);
 
   return SVN_NO_ERROR;
 }
@@ -545,8 +539,8 @@ write_reps(svn_packed__int_stream_t *rep
 
       svn_packed__add_uint(rep_stream, rep->has_sha1);
 
-      svn_packed__add_uint(rep_stream, rep->revision);
-      svn_packed__add_uint(rep_stream, rep->item_index);
+      svn_packed__add_uint(rep_stream, rep->id.change_set);
+      svn_packed__add_uint(rep_stream, rep->id.number);
       svn_packed__add_uint(rep_stream, rep->size);
       svn_packed__add_uint(rep_stream, rep->expanded_size);
 
@@ -670,8 +664,8 @@ read_reps(apr_array_header_t **reps_p,
 
       rep.has_sha1 = (svn_boolean_t)svn_packed__get_uint(rep_stream);
 
-      rep.revision = (svn_revnum_t)svn_packed__get_uint(rep_stream);
-      rep.item_index = svn_packed__get_uint(rep_stream);
+      rep.id.change_set = (svn_revnum_t)svn_packed__get_uint(rep_stream);
+      rep.id.number = svn_packed__get_uint(rep_stream);
       rep.size = svn_packed__get_uint(rep_stream);
       rep.expanded_size = svn_packed__get_uint(rep_stream);
 

Modified: subversion/trunk/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/pack.c?rev=1568792&r1=1568791&r2=1568792&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/pack.c Sun Feb 16 17:05:59 2014
@@ -661,14 +661,15 @@ copy_node_to_temp(pack_context_t *contex
    * This will (often) cause the noderev to be placed right in front of
    * its data representation. */
 
-  if (noderev->data_rep && noderev->data_rep->revision >= context->start_rev)
+  if (noderev->data_rep
+      &&    svn_fs_x__get_revnum(noderev->data_rep->id.change_set)
+         >= context->start_rev)
     {
       reference_t *reference = apr_pcalloc(context->info_pool,
                                            sizeof(*reference));
       reference->from = entry->items[0];
-      reference->to.change_set
-        = svn_fs_x__change_set_by_rev(noderev->data_rep->revision);
-      reference->to.number = noderev->data_rep->item_index;
+      reference->to.change_set = noderev->data_rep->id.change_set;
+      reference->to.number = noderev->data_rep->id.number;
       APR_ARRAY_PUSH(context->references, reference_t *) = reference;
 
       path_order->rep_id = reference->to;
@@ -1256,10 +1257,7 @@ write_reps_containers(pack_context_t *co
         }
 
       assert(entry->item_count == 1);
-      representation.revision
-        = svn_fs_x__get_revnum(entry->items[0].change_set);
-      representation.item_index = entry->items[0].number;
-      svn_fs_x__id_txn_reset(&representation.txn_id);
+      representation.id = entry->items[0];
 
       /* select the change list in the source file, parse it and add it to
        * the container */

Modified: subversion/trunk/subversion/libsvn_fs_x/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/rep-cache.c?rev=1568792&r1=1568791&r2=1568792&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/rep-cache.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/rep-cache.c Sun Feb 16 17:05:59 2014
@@ -56,9 +56,10 @@ rep_has_been_born(representation_t *rep,
                   svn_fs_t *fs,
                   apr_pool_t *pool)
 {
+  svn_revnum_t revision = svn_fs_x__get_revnum(rep->id.change_set);
   SVN_ERR_ASSERT(rep);
 
-  SVN_ERR(svn_fs_x__ensure_revision_exists(rep->revision, fs, pool));
+  SVN_ERR(svn_fs_x__ensure_revision_exists(revision, fs, pool));
 
   return SVN_NO_ERROR;
 }
@@ -191,7 +192,6 @@ svn_fs_x__walk_rep_reference(svn_fs_t *f
 
       /* Construct a representation_t. */
       rep = apr_pcalloc(iterpool, sizeof(*rep));
-      svn_fs_x__id_txn_reset(&rep->txn_id);
       sha1_digest = svn_sqlite__column_text(stmt, 0, iterpool);
       err = svn_checksum_parse_hex(&checksum, svn_checksum_sha1,
                                    sha1_digest, iterpool);
@@ -200,8 +200,8 @@ svn_fs_x__walk_rep_reference(svn_fs_t *f
 
       rep->has_sha1 = TRUE;
       memcpy(rep->sha1_digest, checksum->digest, sizeof(rep->sha1_digest));
-      rep->revision = svn_sqlite__column_revnum(stmt, 1);
-      rep->item_index = svn_sqlite__column_int64(stmt, 2);
+      rep->id.change_set = svn_sqlite__column_revnum(stmt, 1);
+      rep->id.number = svn_sqlite__column_int64(stmt, 2);
       rep->size = svn_sqlite__column_int64(stmt, 3);
       rep->expanded_size = svn_sqlite__column_int64(stmt, 4);
 
@@ -251,12 +251,11 @@ svn_fs_x__get_rep_reference(representati
   if (have_row)
     {
       *rep = apr_pcalloc(pool, sizeof(**rep));
-      svn_fs_x__id_txn_reset(&(*rep)->txn_id);
       memcpy((*rep)->sha1_digest, checksum->digest,
              sizeof((*rep)->sha1_digest));
       (*rep)->has_sha1 = TRUE;
-      (*rep)->revision = svn_sqlite__column_revnum(stmt, 0);
-      (*rep)->item_index = svn_sqlite__column_int64(stmt, 1);
+      (*rep)->id.change_set = svn_sqlite__column_revnum(stmt, 0);
+      (*rep)->id.number = svn_sqlite__column_int64(stmt, 1);
       (*rep)->size = svn_sqlite__column_int64(stmt, 2);
       (*rep)->expanded_size = svn_sqlite__column_int64(stmt, 3);
     }
@@ -297,8 +296,8 @@ svn_fs_x__set_rep_reference(svn_fs_t *fs
   SVN_ERR(svn_sqlite__get_statement(&stmt, ffd->rep_cache_db, STMT_SET_REP));
   SVN_ERR(svn_sqlite__bindf(stmt, "siiii",
                             svn_checksum_to_cstring(&checksum, pool),
-                            (apr_int64_t) rep->revision,
-                            (apr_int64_t) rep->item_index,
+                            (apr_int64_t) rep->id.change_set,
+                            (apr_int64_t) rep->id.number,
                             (apr_int64_t) rep->size,
                             (apr_int64_t) rep->expanded_size));
 
@@ -320,8 +319,7 @@ svn_fs_x__set_rep_reference(svn_fs_t *fs
 
       if (old_rep)
         {
-          if (reject_dup && ((old_rep->revision != rep->revision)
-                             || (old_rep->item_index != rep->item_index)
+          if (reject_dup && (!svn_fs_x__id_part_eq(&old_rep->id, &rep->id)
                              || (old_rep->size != rep->size)
                              || (old_rep->expanded_size != rep->expanded_size)))
             return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
@@ -334,9 +332,9 @@ svn_fs_x__set_rep_reference(svn_fs_t *fs
                               SVN_FILESIZE_T_FMT, APR_OFF_T_FMT,
                               SVN_FILESIZE_T_FMT, SVN_FILESIZE_T_FMT),
                  svn_checksum_to_cstring_display(&checksum, pool),
-                 fs->path, old_rep->revision, old_rep->item_index,
-                 old_rep->size, old_rep->expanded_size, rep->revision,
-                 rep->item_index, rep->size, rep->expanded_size);
+                 fs->path, old_rep->id.change_set, old_rep->id.number,
+                 old_rep->size, old_rep->expanded_size, rep->id.change_set,
+                 rep->id.number, rep->size, rep->expanded_size);
           else
             return SVN_NO_ERROR;
         }

Modified: subversion/trunk/subversion/libsvn_fs_x/reps.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/reps.c?rev=1568792&r1=1568791&r2=1568792&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/reps.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/reps.c Sun Feb 16 17:05:59 2014
@@ -402,8 +402,8 @@ svn_fs_x__reps_add_base(svn_fs_x__reps_b
   SVN_ERR(svn_string_from_stream(&contents, stream, scratch_pool,
                                  scratch_pool));
 
-  base.revision = rep->revision;
-  base.item_index = rep->item_index;
+  base.revision = svn_fs_x__get_revnum(rep->id.change_set);
+  base.item_index = rep->id.number;
   base.priority = priority;
   base.rep = (apr_uint32_t)svn_fs_x__reps_add(builder, contents);
 

Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.c?rev=1568792&r1=1568791&r2=1568792&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.c Sun Feb 16 17:05:59 2014
@@ -578,8 +578,10 @@ store_sha1_rep_mapping(svn_fs_t *fs,
       && noderev->data_rep->has_sha1)
     {
       apr_file_t *rep_file;
+      apr_int64_t txn_id
+        = svn_fs_x__get_txn_id(noderev->data_rep->id.change_set);
       const char *file_name
-        = svn_fs_x__path_txn_sha1(fs,  noderev->data_rep->txn_id,
+        = svn_fs_x__path_txn_sha1(fs, txn_id,
                                   noderev->data_rep->sha1_digest, pool);
       svn_stringbuf_t *rep_string
         = svn_fs_x__unparse_representation(noderev->data_rep,
@@ -1422,7 +1424,7 @@ svn_fs_x__set_entry(svn_fs_t *fs,
   fs_x_data_t *ffd = fs->fsap_data;
   apr_pool_t *subpool = svn_pool_create(pool);
 
-  if (!rep || !svn_fs_x__id_txn_used(rep->txn_id))
+  if (!rep || !svn_fs_x__is_txn(rep->id.change_set))
     {
       apr_hash_t *entries;
 
@@ -1441,8 +1443,8 @@ svn_fs_x__set_entry(svn_fs_t *fs,
 
       /* Mark the node-rev's data rep as mutable. */
       rep = apr_pcalloc(pool, sizeof(*rep));
-      rep->revision = SVN_INVALID_REVNUM;
-      rep->txn_id = txn_id;
+      rep->id.change_set = svn_fs_x__change_set_by_txn(txn_id);
+      rep->id.number = SVN_FS_X__ITEM_INDEX_UNUSED;
       parent_noderev->data_rep = rep;
       SVN_ERR(svn_fs_x__put_node_revision(fs, parent_noderev->id,
                                           parent_noderev, FALSE, pool));
@@ -1764,12 +1766,14 @@ choose_delta_base(representation_t **rep
       base_revision = svn_fs_x__id_rev(base->id);
       if (props)
         {
-          if (base->prop_rep && base_revision > base->prop_rep->revision)
+          if (base->prop_rep &&
+              base_revision > svn_fs_x__get_revnum(base->prop_rep->id.change_set))
             maybe_shared_rep = TRUE;
         }
       else
         {
-          if (base->data_rep && base_revision > base->data_rep->revision)
+          if (base->data_rep &&
+              base_revision > svn_fs_x__get_revnum(base->data_rep->id.change_set))
             maybe_shared_rep = TRUE;
         }
     }
@@ -1873,8 +1877,8 @@ rep_write_get_baton(struct rep_write_bat
   /* Write out the rep header. */
   if (base_rep)
     {
-      header.base_revision = base_rep->revision;
-      header.base_item_index = base_rep->item_index;
+      header.base_revision = svn_fs_x__get_revnum(base_rep->id.change_set);
+      header.base_item_index = base_rep->id.number;
       header.base_length = base_rep->size;
       header.type = svn_fs_x__rep_delta;
     }
@@ -1978,11 +1982,13 @@ get_shared_rep(representation_t **old_re
   /* look for intra-revision matches (usually data reps but not limited
      to them in case props happen to look like some data rep)
    */
-  if (*old_rep == NULL && svn_fs_x__id_txn_used(rep->txn_id))
+  if (*old_rep == NULL && svn_fs_x__is_txn(rep->id.change_set))
     {
       svn_node_kind_t kind;
       const char *file_name
-        = svn_fs_x__path_txn_sha1(fs, rep->txn_id, rep->sha1_digest, pool);
+        = svn_fs_x__path_txn_sha1(fs,
+                                  svn_fs_x__get_txn_id(rep->id.change_set),
+                                  rep->sha1_digest, pool);
 
       /* in our txn, is there a rep file named with the wanted SHA1?
          If so, read it and use that rep.
@@ -2037,6 +2043,7 @@ rep_write_contents_close(void *baton)
   representation_t *rep;
   representation_t *old_rep;
   apr_off_t offset;
+  apr_int64_t txn_id;
 
   rep = apr_pcalloc(b->parent_pool, sizeof(*rep));
 
@@ -2051,8 +2058,8 @@ rep_write_contents_close(void *baton)
 
   /* Fill in the rest of the representation field. */
   rep->expanded_size = b->rep_size;
-  rep->txn_id = svn_fs_x__id_txn_id(b->noderev->id);
-  rep->revision = SVN_INVALID_REVNUM;
+  txn_id = svn_fs_x__id_txn_id(b->noderev->id);
+  rep->id.change_set = svn_fs_x__change_set_by_txn(txn_id);
 
   /* Finalize the checksum. */
   SVN_ERR(digests_final(rep, b->md5_checksum_ctx, b->sha1_checksum_ctx,
@@ -2074,7 +2081,7 @@ rep_write_contents_close(void *baton)
     {
       /* Write out our cosmetic end marker. */
       SVN_ERR(svn_stream_puts(b->rep_stream, "ENDREP\n"));
-      SVN_ERR(allocate_item_index(&rep->item_index, b->fs, rep->txn_id,
+      SVN_ERR(allocate_item_index(&rep->id.number, b->fs, txn_id,
                                   b->rep_offset, b->pool));
 
       b->noderev->data_rep = rep;
@@ -2091,7 +2098,7 @@ rep_write_contents_close(void *baton)
       svn_fs_x__p2l_entry_t entry;
       svn_fs_x__id_part_t noderev_id;
       noderev_id.change_set = SVN_FS_X__INVALID_CHANGE_SET;
-      noderev_id.number = rep->item_index;
+      noderev_id.number = rep->id.number;
 
       entry.offset = b->rep_offset;
       SVN_ERR(svn_fs_x__get_file_offset(&offset, b->file, b->pool));
@@ -2101,11 +2108,11 @@ rep_write_contents_close(void *baton)
       entry.items = &noderev_id;
 
       SVN_ERR(store_sha1_rep_mapping(b->fs, b->noderev, b->pool));
-      SVN_ERR(store_p2l_index_entry(b->fs, rep->txn_id, &entry, b->pool));
+      SVN_ERR(store_p2l_index_entry(b->fs, txn_id, &entry, b->pool));
     }
 
   SVN_ERR(svn_io_file_close(b->file, b->pool));
-  SVN_ERR(unlock_proto_rev(b->fs, rep->txn_id, b->lockcookie, b->pool));
+  SVN_ERR(unlock_proto_rev(b->fs, txn_id, b->lockcookie, b->pool));
   svn_pool_destroy(b->pool);
 
   return SVN_NO_ERROR;
@@ -2205,10 +2212,11 @@ svn_fs_x__set_proplist(svn_fs_t *fs,
 
   /* Mark the node-rev's prop rep as mutable, if not already done. */
   if (!noderev->prop_rep
-      || !svn_fs_x__id_txn_used(noderev->prop_rep->txn_id))
+      || svn_fs_x__is_revision(noderev->prop_rep->id.change_set))
     {
       noderev->prop_rep = apr_pcalloc(pool, sizeof(*noderev->prop_rep));
-      noderev->prop_rep->txn_id = svn_fs_x__id_txn_id(noderev->id);
+      noderev->prop_rep->id.change_set
+        = svn_fs_x__change_set_by_txn(svn_fs_x__id_txn_id(noderev->id));
       SVN_ERR(svn_fs_x__put_node_revision(fs, noderev->id, noderev, FALSE,
                                           pool));
     }
@@ -2293,8 +2301,8 @@ write_hash_delta_rep(representation_t *r
   /* Write out the rep header. */
   if (base_rep)
     {
-      header.base_revision = base_rep->revision;
-      header.base_item_index = base_rep->item_index;
+      header.base_revision = svn_fs_x__get_revnum(base_rep->id.change_set);
+      header.base_item_index = base_rep->id.number;
       header.base_length = base_rep->size;
       header.type = svn_fs_x__rep_delta;
     }
@@ -2352,11 +2360,11 @@ write_hash_delta_rep(representation_t *r
       SVN_ERR(svn_fs_x__get_file_offset(&rep_end, file, pool));
       SVN_ERR(svn_stream_puts(file_stream, "ENDREP\n"));
 
-      SVN_ERR(allocate_item_index(&rep->item_index, fs, txn_id, offset,
+      SVN_ERR(allocate_item_index(&rep->id.number, fs, txn_id, offset,
                                   pool));
 
       noderev_id.change_set = SVN_FS_X__INVALID_CHANGE_SET;
-      noderev_id.number = rep->item_index;
+      noderev_id.number = rep->id.number;
 
       entry.offset = offset;
       SVN_ERR(svn_fs_x__get_file_offset(&offset, file, pool));
@@ -2535,18 +2543,16 @@ write_final_rev(const svn_fs_id_t **new_
       svn_pool_destroy(subpool);
 
       if (noderev->data_rep
-          && svn_fs_x__id_txn_used(noderev->data_rep->txn_id))
+          && ! svn_fs_x__is_revision(noderev->data_rep->id.change_set))
         {
           /* Write out the contents of this directory as a text rep. */
           SVN_ERR(unparse_dir_entries(&str_entries, entries, pool));
-          noderev->data_rep->revision = rev;
+          noderev->data_rep->id.change_set = change_set;
 
           SVN_ERR(write_hash_delta_rep(noderev->data_rep, file,
                                        str_entries, fs, txn_id, noderev,
                                        NULL, SVN_FS_X__ITEM_TYPE_DIR_REP,
                                        pool));
-
-          svn_fs_x__id_txn_reset(&noderev->data_rep->txn_id);
         }
     }
   else
@@ -2556,16 +2562,15 @@ write_final_rev(const svn_fs_id_t **new_
          num. */
 
       if (noderev->data_rep
-          && svn_fs_x__id_txn_used(noderev->data_rep->txn_id))
+          && svn_fs_x__is_txn(noderev->data_rep->id.change_set))
         {
-          svn_fs_x__id_txn_reset(&noderev->data_rep->txn_id);
-          noderev->data_rep->revision = rev;
+          noderev->data_rep->id.change_set = change_set;
         }
     }
 
   /* Fix up the property reps. */
   if (noderev->prop_rep
-      && svn_fs_x__id_txn_used(noderev->prop_rep->txn_id))
+      && svn_fs_x__is_txn(noderev->prop_rep->id.change_set))
     {
       apr_hash_t *proplist;
       int item_type = noderev->kind == svn_node_dir
@@ -2573,8 +2578,7 @@ write_final_rev(const svn_fs_id_t **new_
                     : SVN_FS_X__ITEM_TYPE_FILE_PROPS;
       SVN_ERR(svn_fs_x__get_proplist(&proplist, fs, noderev, pool));
 
-      svn_fs_x__id_txn_reset(&noderev->prop_rep->txn_id);
-      noderev->prop_rep->revision = rev;
+      noderev->prop_rep->id.change_set = change_set;
 
       SVN_ERR(write_hash_delta_rep(noderev->prop_rep, file,
                                    proplist, fs, txn_id, noderev,
@@ -2611,14 +2615,15 @@ write_final_rev(const svn_fs_id_t **new_
     {
       /* Save the data representation's hash in the rep cache. */
       if (   noderev->data_rep && noderev->kind == svn_node_file
-          && noderev->data_rep->revision == rev)
+          && svn_fs_x__get_revnum(noderev->data_rep->id.change_set) == rev)
         {
           SVN_ERR_ASSERT(reps_to_cache && reps_pool);
           APR_ARRAY_PUSH(reps_to_cache, representation_t *)
             = svn_fs_x__rep_copy(noderev->data_rep, reps_pool);
         }
 
-      if (noderev->prop_rep && noderev->prop_rep->revision == rev)
+      if (   noderev->prop_rep
+          && svn_fs_x__get_revnum(noderev->prop_rep->id.change_set) == rev)
         {
           /* Add new property reps to hash and on-disk cache. */
           representation_t *copy
@@ -3419,13 +3424,13 @@ svn_fs_x__delete_node_revision(svn_fs_t 
 
   /* Delete any mutable property representation. */
   if (noderev->prop_rep
-      && svn_fs_x__id_txn_used(noderev->prop_rep->txn_id))
+      && svn_fs_x__is_txn(noderev->prop_rep->id.change_set))
     SVN_ERR(svn_io_remove_file2(svn_fs_x__path_txn_node_props(fs, id, pool),
                                 FALSE, pool));
 
   /* Delete any mutable data representation. */
   if (noderev->data_rep
-      && svn_fs_x__id_txn_used(noderev->data_rep->txn_id)
+      && svn_fs_x__is_txn(noderev->data_rep->id.change_set)
       && noderev->kind == svn_node_dir)
     {
       fs_x_data_t *ffd = fs->fsap_data;

Modified: subversion/trunk/subversion/libsvn_fs_x/verify.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/verify.c?rev=1568792&r1=1568791&r2=1568792&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/verify.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/verify.c Sun Feb 16 17:05:59 2014
@@ -78,13 +78,14 @@ verify_walker(representation_t *rep,
   if (   walker_baton->iteration_count > 1000
       || walker_baton->file_count > 16)
     {
+      svn_revnum_t revision = svn_fs_x__get_revnum(rep->id.change_set);
       if (   walker_baton->notify_func
-          && rep->revision != walker_baton->last_notified_revision)
+          && revision != walker_baton->last_notified_revision)
         {
-          walker_baton->notify_func(rep->revision,
+          walker_baton->notify_func(revision,
                                     walker_baton->notify_baton,
                                     scratch_pool);
-          walker_baton->last_notified_revision = rep->revision;
+          walker_baton->last_notified_revision = revision;
         }
 
       svn_pool_clear(walker_baton->pool);