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 2016/05/21 21:51:01 UTC

svn commit: r1744991 - in /subversion/trunk/subversion/libsvn_fs_x: cached_data.c changes.c fs.h

Author: stefan2
Date: Sat May 21 21:51:01 2016
New Revision: 1744991

URL: http://svn.apache.org/viewvc?rev=1744991&view=rev
Log:
Code cleanup in FSX:
Have a central block size definitions for changed path lists.

* subversion/libsvn_fs_x/fs.h
  (SVN_FS_X__CHANGES_BLOCK_SIZE): New define.

* subversion/libsvn_fs_x/cached_data.c
  (block_read_changes): Replace the local BLOCK_SIZE with the above define.

* subversion/libsvn_fs_x/changes.c
  (svn_fs_x__changes_get_list,
   svn_fs_x__changes_get_list_func): Same.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/cached_data.c
    subversion/trunk/subversion/libsvn_fs_x/changes.c
    subversion/trunk/subversion/libsvn_fs_x/fs.h

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=1744991&r1=1744990&r2=1744991&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/cached_data.c Sat May 21 21:51:01 2016
@@ -2992,8 +2992,6 @@ block_read_changes(apr_array_header_t **
                    apr_pool_t *result_pool,
                    apr_pool_t *scratch_pool)
 {
-  enum { BLOCK_SIZE = 100 };
-
   svn_fs_x__data_t *ffd = fs->fsap_data;
   svn_stream_t *stream;
   svn_fs_x__pair_cache_key_t key;
@@ -3032,7 +3030,7 @@ block_read_changes(apr_array_header_t **
   SVN_ERR(svn_fs_x__rev_file_stream(&stream, rev_file));
 
   /* read changes from revision file */
-  SVN_ERR(svn_fs_x__read_changes(changes, stream, BLOCK_SIZE,
+  SVN_ERR(svn_fs_x__read_changes(changes, stream, SVN_FS_X__CHANGES_BLOCK_SIZE,
                                  result_pool, scratch_pool));
 
   SVN_ERR(svn_fs_x__rev_file_offset(&changes_list.end_offset, rev_file));
@@ -3040,7 +3038,7 @@ block_read_changes(apr_array_header_t **
   changes_list.start_offset = next_offset;
   changes_list.count = (*changes)->nelts;
   changes_list.changes = (svn_fs_x__change_t **)(*changes)->elts;
-  changes_list.eol =    (changes_list.count < BLOCK_SIZE)
+  changes_list.eol =    (changes_list.count < SVN_FS_X__CHANGES_BLOCK_SIZE)
                      || (changes_list.end_offset + 1 >= entry->size);
 
   /* cache for future reference */

Modified: subversion/trunk/subversion/libsvn_fs_x/changes.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/changes.c?rev=1744991&r1=1744990&r2=1744991&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/changes.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/changes.c Sat May 21 21:51:01 2016
@@ -221,10 +221,6 @@ svn_fs_x__changes_get_list(apr_array_hea
   int last;
   int i;
 
-  /* Return up to this many entries.  Anything > 0 will do.
-   * At 100..300 bytes per entry, this limits the allocation to ~30kB. */
-  enum { BLOCK_SIZE = 100 };
-
   /* CHANGES must be in 'finalized' mode */
   SVN_ERR_ASSERT(changes->builder == NULL);
   SVN_ERR_ASSERT(changes->paths);
@@ -245,7 +241,7 @@ svn_fs_x__changes_get_list(apr_array_hea
   /* Restrict it to the sub-range requested by the caller.
    * Clip the range to never exceed the list's content. */
   first = MIN(context->next + list_first, list_last);
-  last = MIN(first + BLOCK_SIZE, list_last);
+  last = MIN(first + SVN_FS_X__CHANGES_BLOCK_SIZE, list_last);
 
   /* Indicate to the caller whether the end of the list has been reached. */
   context->eol = last == list_last;
@@ -461,7 +457,6 @@ svn_fs_x__changes_get_list_func(void **o
   int last;
   int i;
   apr_array_header_t *list;
-  enum { BLOCK_SIZE = 100 };
 
   svn_fs_x__changes_get_list_baton_t *b = baton;
   apr_uint32_t idx = b->sub_item;
@@ -498,7 +493,7 @@ svn_fs_x__changes_get_list_func(void **o
   /* Restrict range to the block requested by the BATON.
    * Tell the caller whether we reached the end of the list. */
   first = MIN(first + b->start, last);
-  last = MIN(first + BLOCK_SIZE, last);
+  last = MIN(first + SVN_FS_X__CHANGES_BLOCK_SIZE, last);
   *b->eol = last == offsets[idx+1];
 
   /* construct result */

Modified: subversion/trunk/subversion/libsvn_fs_x/fs.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs.h?rev=1744991&r1=1744990&r2=1744991&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs.h Sat May 21 21:51:01 2016
@@ -137,6 +137,11 @@ extern "C" {
 #define SVN_FS_X__USE_LOCK_MUTEX 0
 #endif
 
+/* Maximum number of changes we deliver per request when listing the
+   changed paths for a given revision.   Anything > 0 will do.
+   At 100..300 bytes per entry, this limits the allocation to ~30kB. */
+#define SVN_FS_X__CHANGES_BLOCK_SIZE 100
+
 /* Private FSX-specific data shared between all svn_txn_t objects that
    relate to a particular transaction in a filesystem (as identified
    by transaction id and filesystem UUID).  Objects of this type are