subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1744981 - in /subversion/trunk/subversion/libsvn_fs_x: cached_data.c low_level.c low_level.h pack.c
Date Sat, 21 May 2016 20:45:55 GMT
Author: stefan2
Date: Sat May 21 20:45:55 2016
New Revision: 1744981

URL: http://svn.apache.org/viewvc?rev=1744981&view=rev
Log:
In FSX, begin adding chunked read support for changed paths list when reading
them from disk.

This patch simply allows us to limit the number of list entries read at once.
The callers, however, will not impose an actual limit ATM.

* subversion/libsvn_fs_x/low_level.h
  (svn_fs_x__read_changes): Add the MAX_COUNT parameter.

* subversion/libsvn_fs_x/low_level.c
  (svn_fs_x__read_changes): Never read more than MAX_COUNT elements from the
                            current stream locastion.

* subversion/libsvn_fs_x/cached_data.c
  (block_read_changes): Update caller, still reading unlimited amounts of data.

* subversion/libsvn_fs_x/pack.c
  (write_changes_containers): Same.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/cached_data.c
    subversion/trunk/subversion/libsvn_fs_x/low_level.c
    subversion/trunk/subversion/libsvn_fs_x/low_level.h
    subversion/trunk/subversion/libsvn_fs_x/pack.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=1744981&r1=1744980&r2=1744981&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/cached_data.c Sat May 21 20:45:55 2016
@@ -3001,7 +3001,8 @@ block_read_changes(apr_array_header_t **
   SVN_ERR(read_item(&stream, fs, rev_file, entry, scratch_pool));
 
   /* read changes from revision file */
-  SVN_ERR(svn_fs_x__read_changes(changes, stream, result_pool, scratch_pool));
+  SVN_ERR(svn_fs_x__read_changes(changes, stream, INT_MAX,
+                                 result_pool, scratch_pool));
 
   /* cache for future reference */
 

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=1744981&r1=1744980&r2=1744981&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/low_level.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/low_level.c Sat May 21 20:45:55 2016
@@ -974,10 +974,10 @@ read_change(svn_fs_x__change_t **change_
 svn_error_t *
 svn_fs_x__read_changes(apr_array_header_t **changes,
                        svn_stream_t *stream,
+                       int max_count,
                        apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
 {
-  svn_fs_x__change_t *change;
   apr_pool_t *iterpool;
 
   /* Pre-allocate enough room for most change lists.
@@ -990,13 +990,16 @@ svn_fs_x__read_changes(apr_array_header_
    */
   *changes = apr_array_make(result_pool, 63, sizeof(svn_fs_x__change_t *));
 
-  SVN_ERR(read_change(&change, stream, result_pool, scratch_pool));
   iterpool = svn_pool_create(scratch_pool);
-  while (change)
+  for (; max_count > 0; --max_count)
     {
-      APR_ARRAY_PUSH(*changes, svn_fs_x__change_t*) = change;
-      SVN_ERR(read_change(&change, stream, result_pool, iterpool));
+      svn_fs_x__change_t *change;
       svn_pool_clear(iterpool);
+      SVN_ERR(read_change(&change, stream, result_pool, iterpool));
+      if (!change)
+        break;
+ 
+      APR_ARRAY_PUSH(*changes, svn_fs_x__change_t*) = change;
     }
   svn_pool_destroy(iterpool);
 

Modified: subversion/trunk/subversion/libsvn_fs_x/low_level.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/low_level.h?rev=1744981&r1=1744980&r2=1744981&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/low_level.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/low_level.h Sat May 21 20:45:55 2016
@@ -170,11 +170,13 @@ svn_fs_x__write_rep_header(svn_fs_x__rep
                            svn_stream_t *stream,
                            apr_pool_t *scratch_pool);
 
-/* Read all the changes from STREAM and store them in *CHANGES,
-   allocated in RESULT_POOL. Do temporary allocations in SCRATCH_POOL. */
+/* Read up to MAX_COUNT of the changes from STREAM and store them in
+   *CHANGES, allocated in RESULT_POOL.  Do temporary allocations in
+   SCRATCH_POOL. */
 svn_error_t *
 svn_fs_x__read_changes(apr_array_header_t **changes,
                        svn_stream_t *stream,
+                       int max_count,
                        apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool);
 

Modified: subversion/trunk/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/pack.c?rev=1744981&r1=1744980&r2=1744981&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/pack.c Sat May 21 20:45:55 2016
@@ -1603,8 +1603,8 @@ write_changes_containers(pack_context_t
        * the container */
       SVN_ERR(svn_io_file_seek(temp_file, APR_SET, &entry->offset,
                                iterpool));
-      SVN_ERR(svn_fs_x__read_changes(&changes, temp_stream, scratch_pool,
-                                     iterpool));
+      SVN_ERR(svn_fs_x__read_changes(&changes, temp_stream, INT_MAX,
+                                     scratch_pool, iterpool));
       SVN_ERR(svn_fs_x__changes_append_list(&list_index, container, changes));
       SVN_ERR_ASSERT(list_index == sub_items->nelts);
       block_left -= estimated_size;



Mime
View raw message