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/07/02 23:26:10 UTC

svn commit: r1499117 - in /subversion/branches/fsfs-format7/subversion/libsvn_fs_x: cached_data.c fs.h pack.c

Author: stefan2
Date: Tue Jul  2 21:26:09 2013
New Revision: 1499117

URL: http://svn.apache.org/r1499117
Log:
On the fsfs-format7 branch:  After dropping support for PLAIN reps in FSX,
we can got rid of one of FSFS's most annoying idiosyncrasies, i.e. not
knowing the plaintext size ("expanded size") of a presentation.

This patch simply cleans up by removing all checks for 0-sized expanded_size
values.

* subversion/libsvn_fs_x/fs.h
  (representation_t): update commentary

* subversion/libsvn_fs_x/pack.c
  (copy_node_to_temp): simplify

* subversion/libsvn_fs_x/cached_data.c
  (build_rep_list): drop "expanded_size" I/O parameter
  (rep_read_get_baton): update caller
  (svn_fs_x__get_contents,
   get_dir_contents): simplify

Modified:
    subversion/branches/fsfs-format7/subversion/libsvn_fs_x/cached_data.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_x/fs.h
    subversion/branches/fsfs-format7/subversion/libsvn_fs_x/pack.c

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_x/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_x/cached_data.c?rev=1499117&r1=1499116&r2=1499117&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_x/cached_data.c Tue Jul  2 21:26:09 2013
@@ -1024,14 +1024,11 @@ set_cached_combined_window(svn_stringbuf
    Also, set *WINDOW_P to the base window content for *LIST, if it
    could be found in cache. Otherwise, *LIST will contain the base
    representation for the whole delta chain.
-   Finally, return the expanded size of the representation in
-   *EXPANDED_SIZE. It will take care of cases where only the on-disk
-   size is known.  */
+ */
 static svn_error_t *
 build_rep_list(apr_array_header_t **list,
                svn_stringbuf_t **window_p,
                rep_state_t **src_state,
-               svn_filesize_t *expanded_size,
                svn_fs_t *fs,
                representation_t *first_rep,
                apr_pool_t *pool)
@@ -1045,23 +1042,9 @@ build_rep_list(apr_array_header_t **list
   *list = apr_array_make(pool, 1, sizeof(struct rep_state *));
   rep = *first_rep;
 
-  /* The value as stored in the data struct.
-     0 is either for unknown length or actually zero length. */
-  *expanded_size = first_rep->expanded_size;
-
   /* for the top-level rep, we need the rep_args */
   SVN_ERR(create_rep_state(&rs, &rep_header, &shared_file, &rep, fs, pool));
 
-  /* Unknown size or empty representation?
-     That implies the this being the first iteration.
-     Usually size equals on-disk size, except for empty,
-     compressed representations (delta, size = 4).
-     Please note that for all non-empty deltas have
-     a 4-byte header _plus_ some data. */
-  if (*expanded_size == 0)
-    if (first_rep->size != 4)
-      *expanded_size = first_rep->size;
-
   while (1)
     {
       /* fetch state, if that has not been done already */
@@ -1139,9 +1122,8 @@ rep_read_get_baton(struct rep_read_baton
   b->pool = svn_pool_create(pool);
   b->filehandle_pool = svn_pool_create(pool);
 
-  SVN_ERR(build_rep_list(&b->rs_list, &b->base_window,
-                         &b->src_state, &b->len, fs, rep,
-                         b->filehandle_pool));
+  SVN_ERR(build_rep_list(&b->rs_list, &b->base_window, &b->src_state,
+                         fs, rep, b->filehandle_pool));
 
   if (SVN_IS_VALID_REVNUM(fulltext_cache_key.revision))
     b->current_fulltext = svn_stringbuf_create_ensure
@@ -1782,7 +1764,7 @@ svn_fs_x__get_contents(svn_stream_t **co
     {
       fs_x_data_t *ffd = fs->fsap_data;
       pair_cache_key_t fulltext_cache_key = { 0 };
-      svn_filesize_t len = rep->expanded_size ? rep->expanded_size : rep->size;
+      svn_filesize_t len = rep->expanded_size;
       struct rep_read_baton *rb;
 
       fulltext_cache_key.revision = rep->revision;
@@ -2003,9 +1985,7 @@ get_dir_contents(apr_hash_t *entries,
        * parse it byte-by-byte.
        */
       apr_pool_t *text_pool = svn_pool_create(pool);
-      apr_size_t len = noderev->data_rep->expanded_size
-                     ? (apr_size_t)noderev->data_rep->expanded_size
-                     : (apr_size_t)noderev->data_rep->size;
+      apr_size_t len = noderev->data_rep->expanded_size;
       svn_stringbuf_t *text = svn_stringbuf_create_ensure(len, text_pool);
       text->len = len;
 

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_x/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_x/fs.h?rev=1499117&r1=1499116&r2=1499117&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_x/fs.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_x/fs.h Tue Jul  2 21:26:09 2013
@@ -448,8 +448,7 @@ typedef struct representation_t
      file. */
   svn_filesize_t size;
 
-  /* The size of the fulltext of the representation. If this is 0,
-   * the fulltext size is equal to representation size in the rev file, */
+  /* The size of the fulltext of the representation. */
   svn_filesize_t expanded_size;
 
   /* Is this representation a transaction? */

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_x/pack.c?rev=1499117&r1=1499116&r2=1499117&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_x/pack.c Tue Jul  2 21:26:09 2013
@@ -666,9 +666,7 @@ copy_node_to_temp(pack_context_t *contex
       APR_ARRAY_PUSH(context->references, reference_t *) = reference;
 
       path_order->rep_id = reference->to;
-      path_order->expanded_size = noderev->data_rep->expanded_size
-                                ? noderev->data_rep->expanded_size
-                                : noderev->data_rep->size;
+      path_order->expanded_size = noderev->data_rep->expanded_size;
     }
 
   path_order->path = svn__prefix_string_create(context->paths,