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 2013/05/12 01:17:52 UTC
svn commit: r1481452 - in
/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs: cached_data.c
fs.h index.c index.h
Author: stefan2
Date: Sat May 11 23:17:52 2013
New Revision: 1481452
URL: http://svn.apache.org/r1481452
Log:
On the fsfs-format7 branch: Minimize cache and index addressing.
Membuffer cache access is fastest for 16 byte-sized keys, so use
them where possible.
* subversion/libsvn_fs_fs/index.h
(svn_fs_fs__page_cache_key): shorten revision values to 32 bits
* subversion/libsvn_fs_fs/fs.h
(window_cache_key_t): ditto; reorder to allow struct packing
* subversion/libsvn_fs_fs/index.c
(packed_stream_close): itself a shallow wrapper -> should be inlined
(prefetch_l2p_pages,
l2p_index_lookup,
prefetch_p2l_page,
get_p2l_keys): cast revs to 32 bits; assert() that that's o.k.
* subversion/libsvn_fs_fs/cached_data.c
(get_window_key): ditto
Modified:
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h
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/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c?rev=1481452&r1=1481451&r2=1481452&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c Sat May 11 23:17:52 2013
@@ -940,6 +940,7 @@ struct rep_read_baton
static window_cache_key_t *
get_window_key(window_cache_key_t *key, rep_state_t *rs)
{
+ assert(rs->revision <= APR_UINT32_MAX);
key->revision = (apr_uint32_t)rs->revision;
key->item_index = rs->item_index;
key->chunk_index = rs->chunk_index;
Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h?rev=1481452&r1=1481451&r2=1481452&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h Sat May 11 23:17:52 2013
@@ -247,13 +247,13 @@ typedef struct pair_cache_key_t
typedef struct window_cache_key_t
{
/* Revision that contains the representation */
- svn_revnum_t revision;
-
- /* Item index of the representation */
- apr_uint64_t item_index;
+ apr_uint32_t revision;
/* Window number within that representation */
int chunk_index;
+
+ /* Item index of the representation */
+ apr_uint64_t item_index;
} window_cache_key_t;
/* Private (non-shared) FSFS-specific data for each svn_fs_t object.
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=1481452&r1=1481451&r2=1481452&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c Sat May 11 23:17:52 2013
@@ -329,6 +329,7 @@ packed_stream_open(packed_number_stream_
/* Close STREAM which may be NULL.
*/
+SVN__FORCE_INLINE
static svn_error_t *
packed_stream_close(packed_number_stream_t *stream)
{
@@ -1373,7 +1374,8 @@ prefetch_l2p_pages(svn_boolean_t *end,
/* prefetch pages individually until all are done or we found one in
* the cache */
iterpool = svn_pool_create(scratch_pool);
- key.revision = revision;
+ assert(revision <= APR_UINT32_MAX);
+ key.revision = (apr_uint32_t)revision;
key.is_packed = is_packed_rev(fs, revision);
for (i = 0; i < pages->nelts && !*end; ++i)
@@ -1447,7 +1449,8 @@ l2p_index_lookup(apr_off_t *offset,
page_baton.item_index = item_index;
page_baton.page_offset = info_baton.page_offset;
- key.revision = revision;
+ assert(revision <= APR_UINT32_MAX);
+ key.revision = (apr_uint32_t)revision;
key.is_packed = is_packed_rev(fs, revision);
key.page = info_baton.page_no;
@@ -2196,7 +2199,8 @@ prefetch_p2l_page(svn_boolean_t *end,
}
/* do we have that page in our caches already? */
- key.revision = baton->first_revision;
+ assert(baton->first_revision <= APR_UINT32_MAX);
+ key.revision = (apr_uint32_t)baton->first_revision;
key.is_packed = is_packed_rev(fs, baton->first_revision);
key.page = baton->page_no;
SVN_ERR(svn_cache__has_key(&already_cached, ffd->p2l_page_cache,
@@ -2270,7 +2274,8 @@ get_p2l_keys(p2l_page_info_baton_t *page
if (key_p)
{
svn_fs_fs__page_cache_key_t key = { 0 };
- key.revision = page_info.first_revision;
+ assert(page_info.first_revision <= APR_UINT32_MAX);
+ key.revision = (apr_uint32_t)page_info.first_revision;
key.is_packed = is_packed_rev(fs, revision);
key.page = page_info.page_no;
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=1481452&r1=1481451&r2=1481452&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.h Sat May 11 23:17:52 2013
@@ -246,7 +246,7 @@ typedef struct svn_fs_fs__page_cache_key
{
/* in l2p: this is the revision of the items being mapped
in p2l: this is the start revision identifying the pack / rev file */
- svn_revnum_t revision;
+ apr_uint32_t revision;
/* if TRUE, this is the index to a pack file
*/