subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1438436 - in /subversion/branches/fsfs-format7/subversion/libsvn_fs_fs: index.c index.h
Date Fri, 25 Jan 2013 10:43:32 GMT
Author: stefan2
Date: Fri Jan 25 10:43:31 2013
New Revision: 1438436

URL: http://svn.apache.org/viewvc?rev=1438436&view=rev
Log:
On the fsfs-format7 branch:  Add a new internal API function to
determine the number of items we need to copy per rev to pack files,

* subversion/libsvn_fs_fs/index.h
  (svn_fs_fs__l2p_get_max_ids): declare new function

* subversion/libsvn_fs_fs/index.c
  (svn_fs_fs__l2p_get_max_ids): implement new function

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

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c?rev=1438436&r1=1438435&r2=1438436&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c Fri Jan 25 10:43:31 2013
@@ -607,6 +607,42 @@ l2p_proto_index_lookup(apr_off_t *offset
 }
 
 svn_error_t *
+svn_fs_fs__l2p_get_max_ids(apr_array_header_t **max_ids,
+                           svn_fs_t *fs,
+                           svn_revnum_t start_rev,
+                           apr_size_t count,
+                           apr_pool_t *pool)
+{
+  l2p_index_header_t *header = NULL;
+  svn_revnum_t revision;
+  svn_revnum_t last_rev = (svn_revnum_t)(start_rev + count);
+
+  /* read index master data structure */
+  SVN_ERR(get_l2p_header(&header, fs, start_rev, pool));
+
+  *max_ids = apr_array_make(pool, (int)count, sizeof(apr_uint64_t));
+  for (revision = start_rev; revision < last_rev; ++revision)
+    {
+      apr_uint64_t page_count;
+      l2_index_page_table_entry_t *last_entry;
+      apr_uint64_t item_count;
+
+      if (revision >= header->first_revision + header->revision_count)
+        SVN_ERR(get_l2p_header(&header, fs, revision, pool));
+
+      page_count = header->page_tables[revision - header->first_revision + 1]
+                 - header->page_tables[revision - header->first_revision] - 1;
+      last_entry = header->page_tables[revision - header->first_revision + 1]
+                 - 1;
+      item_count = page_count * header->page_size + last_entry->entry_count;
+
+      APR_ARRAY_PUSH(*max_ids, apr_uint64_t) = item_count;
+    }
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_fs_fs__p2l_proto_index_open(apr_file_t **proto_index,
                                 const char *file_name,
                                 apr_pool_t *pool)

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.h?rev=1438436&r1=1438435&r2=1438436&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.h Fri Jan 25 10:43:31 2013
@@ -167,4 +167,16 @@ svn_fs_fs__item_offset(apr_off_t *offset
                        apr_uint64_t item_index,
                        apr_pool_t *pool);
 
+/* Use the log-to-phys indexes in FS to determine the maximum item indexes
+ * assigned to revision START_REV to START_REV + COUNT - 1.  That is a
+ * close upper limit to the actual number of items in the respective revs.
+ * Return the results in *MAX_IDS,  allocated in POOL.
+ */
+svn_error_t *
+svn_fs_fs__l2p_get_max_ids(apr_array_header_t **max_ids,
+                           svn_fs_t *fs,
+                           svn_revnum_t start_rev,
+                           apr_size_t count,
+                           apr_pool_t *pool);
+
 #endif



Mime
View raw message