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/04/11 06:01:32 UTC

svn commit: r1586554 - in /subversion/branches/thunder/subversion/libsvn_fs_fs: index.c util.c util.h

Author: stefan2
Date: Fri Apr 11 04:01:31 2014
New Revision: 1586554

URL: http://svn.apache.org/r1586554
Log:
On the thunder branch: Extend THUNDER-awareness to the L2P index in format7.
The reverse (P2L) index will be indirectly covered by block_read in a
following commit.

* subversion/libsvn_fs_fs/util.h
  (svn_fs_fs__thundered_cache_get_partial): Another THUNDER-handling wrapper
                                            around our cache accessors.

* subversion/libsvn_fs_fs/util.c
  (svn_fs_fs__thundered_cache_get_partial): Implement it.

* subversion/libsvn_fs_fs/index.c
  (get_l2p_page_info,
   l2p_index_lookup): Use THUNDER-aware cache / data access.

Modified:
    subversion/branches/thunder/subversion/libsvn_fs_fs/index.c
    subversion/branches/thunder/subversion/libsvn_fs_fs/util.c
    subversion/branches/thunder/subversion/libsvn_fs_fs/util.h

Modified: subversion/branches/thunder/subversion/libsvn_fs_fs/index.c
URL: http://svn.apache.org/viewvc/subversion/branches/thunder/subversion/libsvn_fs_fs/index.c?rev=1586554&r1=1586553&r2=1586554&view=diff
==============================================================================
--- subversion/branches/thunder/subversion/libsvn_fs_fs/index.c (original)
+++ subversion/branches/thunder/subversion/libsvn_fs_fs/index.c Fri Apr 11 04:01:31 2014
@@ -984,15 +984,18 @@ get_l2p_page_info(l2p_page_info_baton_t 
   l2p_header_t *result;
   svn_boolean_t is_cached = FALSE;
   void *dummy = NULL;
+  svn_fs__thunder_access_t *access;
 
   /* try to find the info in the cache */
   pair_cache_key_t key;
   key.revision = rev_file->start_revision;
   key.second = rev_file->is_packed;
-  SVN_ERR(svn_cache__get_partial((void**)&dummy, &is_cached,
-                                 ffd->l2p_header_cache, &key,
-                                 l2p_page_info_access_func, baton,
-                                 pool));
+  SVN_ERR(svn_fs_fs__thundered_cache_get_partial((void**)&dummy, &is_cached,
+                                                 &access, fs, "L2P:HEADER",
+                                                 key.revision, key.second,
+                                                 ffd->l2p_header_cache, &key,
+                                                 l2p_page_info_access_func,
+                                                 baton, pool));
   if (is_cached)
     return SVN_NO_ERROR;
 
@@ -1001,6 +1004,9 @@ get_l2p_page_info(l2p_page_info_baton_t 
   SVN_ERR(l2p_page_info_copy(baton, result, result->page_table,
                              result->page_table_index));
 
+  /* Completed our data access. */
+  SVN_ERR(svn_fs__thunder_end_access(access));
+
   return SVN_NO_ERROR;
 }
 
@@ -1290,6 +1296,7 @@ l2p_index_lookup(apr_off_t *offset,
   svn_fs_fs__page_cache_key_t key = { 0 };
   svn_boolean_t is_cached = FALSE;
   void *dummy = NULL;
+  svn_fs__thunder_access_t *access;
 
   /* read index master data structure and extract the info required to
    * access the l2p index page for (REVISION,ITEM_INDEX)*/
@@ -1307,9 +1314,11 @@ l2p_index_lookup(apr_off_t *offset,
   key.is_packed = svn_fs_fs__is_packed_rev(fs, revision);
   key.page = info_baton.page_no;
 
-  SVN_ERR(svn_cache__get_partial(&dummy, &is_cached,
-                                 ffd->l2p_page_cache, &key,
-                                 l2p_entry_access_func, &page_baton, pool));
+  SVN_ERR(svn_fs_fs__thundered_cache_get_partial
+            (&dummy, &is_cached, &access, fs, "L2P", rev_file->start_revision,
+             info_baton.entry.offset / ffd->block_size,
+             ffd->l2p_page_cache, &key, l2p_entry_access_func, &page_baton,
+             pool));
 
   if (!is_cached)
     {
@@ -1368,6 +1377,9 @@ l2p_index_lookup(apr_off_t *offset,
         }
 
       svn_pool_destroy(iterpool);
+
+      /* Completed our data access. */
+      SVN_ERR(svn_fs__thunder_end_access(access));
     }
 
   *offset = page_baton.offset;

Modified: subversion/branches/thunder/subversion/libsvn_fs_fs/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/thunder/subversion/libsvn_fs_fs/util.c?rev=1586554&r1=1586553&r2=1586554&view=diff
==============================================================================
--- subversion/branches/thunder/subversion/libsvn_fs_fs/util.c (original)
+++ subversion/branches/thunder/subversion/libsvn_fs_fs/util.c Fri Apr 11 04:01:31 2014
@@ -671,3 +671,34 @@ svn_fs_fs__thundered_cache_get(void **va
 
   return SVN_NO_ERROR;
 }
+
+
+svn_error_t *
+svn_fs_fs__thundered_cache_get_partial(void **value,
+                                       svn_boolean_t *found,
+                                       svn_fs__thunder_access_t **access,
+                                       svn_fs_t *fs,
+                                       const char *tag,
+                                       svn_revnum_t revision,
+                                       apr_uint64_t location,
+                                       svn_cache__t *cache,
+                                       const void *key,
+                                       svn_cache__partial_getter_func_t func,
+                                       void *baton,
+                                       apr_pool_t *pool)
+{
+  SVN_ERR(svn_cache__get_partial(value, found, cache, key, func, baton,
+                                 pool));
+  if (!*found)
+    {
+      const char *access_path = apr_psprintf(pool, "%s:%s:%ld",
+                                             fs->path, tag, revision);
+      SVN_ERR(svn_fs__thunder_begin_access(access, svn_fs_fs__get_thunder(),
+                                           access_path, location, pool));
+      if (!*access)
+        SVN_ERR(svn_cache__get_partial(value, found, cache, key, func, baton,
+                                       pool));
+    }
+
+  return SVN_NO_ERROR;
+}

Modified: subversion/branches/thunder/subversion/libsvn_fs_fs/util.h
URL: http://svn.apache.org/viewvc/subversion/branches/thunder/subversion/libsvn_fs_fs/util.h?rev=1586554&r1=1586553&r2=1586554&view=diff
==============================================================================
--- subversion/branches/thunder/subversion/libsvn_fs_fs/util.h (original)
+++ subversion/branches/thunder/subversion/libsvn_fs_fs/util.h Fri Apr 11 04:01:31 2014
@@ -412,4 +412,21 @@ svn_fs_fs__thundered_cache_get(void **va
                                const void *key,
                                apr_pool_t *pool);
 
+/* Wrapper around svn_cache__get_packed similar to
+ * svn_fs_fs__thundered_cache_get.
+ */
+svn_error_t *
+svn_fs_fs__thundered_cache_get_partial(void **value,
+                                       svn_boolean_t *found,
+                                       svn_fs__thunder_access_t **access,
+                                       svn_fs_t *fs,
+                                       const char *tag,
+                                       svn_revnum_t revision,
+                                       apr_uint64_t location,
+                                       svn_cache__t *cache,
+                                       const void *key,
+                                       svn_cache__partial_getter_func_t func,
+                                       void *baton,
+                                       apr_pool_t *pool);
+
 #endif