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/27 21:24:44 UTC

svn commit: r1590464 - /subversion/trunk/subversion/libsvn_fs_fs/index.c

Author: stefan2
Date: Sun Apr 27 19:24:44 2014
New Revision: 1590464

URL: http://svn.apache.org/r1590464
Log:
Fix an inefficiency in the L2P index page prefetcher: Always prefetch all
pages in the current block - even if some of them are already in cache.

Inserting data into cache is unreliable (writes won't wait for concurrent
reads to finish but simply exit without changing the cache).  Thus, if we
have to (re-)read one page, we should keep prefetching all others in the
same block (they are likely missing as well) even if a few of them are
already / still in cache.

* subversion/libsvn_fs_fs/index.c
  (prefetch_l2p_pages): Don't stop prefetching upon cache hit.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/index.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/index.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/index.c?rev=1590464&r1=1590463&r2=1590464&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/index.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/index.c Sun Apr 27 19:24:44 2014
@@ -1174,6 +1174,8 @@ prefetch_l2p_pages(svn_boolean_t *end,
 
   for (i = 0; i < pages->nelts && !*end; ++i)
     {
+      svn_boolean_t is_cached;
+
       l2p_page_table_entry_t *entry
         = &APR_ARRAY_IDX(pages, i, l2p_page_table_entry_t);
       svn_pool_clear(iterpool);
@@ -1191,9 +1193,9 @@ prefetch_l2p_pages(svn_boolean_t *end,
 
       /* page already in cache? */
       key.page = i;
-      SVN_ERR(svn_cache__has_key(end, ffd->l2p_page_cache,
+      SVN_ERR(svn_cache__has_key(&is_cached, ffd->l2p_page_cache,
                                  &key, iterpool));
-      if (!*end)
+      if (!is_cached)
         {
           /* no in cache -> read from stream (data already buffered in APR)
            * and cache the result */