Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/cached_data.c URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/cached_data.c?rev=1652409&r1=1652408&r2=1652409&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/cached_data.c (original) +++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/cached_data.c Fri Jan 16 14:01:35 2015 @@ -52,7 +52,7 @@ static svn_error_t * block_read(void **result, svn_fs_t *fs, - const svn_fs_x__id_part_t *id, + const svn_fs_x__id_t *id, svn_fs_x__revision_file_t *revision_file, apr_pool_t *result_pool, apr_pool_t *scratch_pool); @@ -68,14 +68,14 @@ block_read(void **result, */ static svn_error_t * dgb__log_access(svn_fs_t *fs, - const svn_fs_x__id_part_t *id, + const svn_fs_x__id_t *id, void *item, apr_uint32_t item_type, apr_pool_t *scratch_pool) { /* no-op if this macro is not defined */ #ifdef SVN_FS_X__LOG_ACCESS - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; apr_off_t offset = -1; apr_off_t end_offset = 0; apr_uint32_t sub_item = 0; @@ -98,7 +98,7 @@ dgb__log_access(svn_fs_t *fs, /* construct description if possible */ if (item_type == SVN_FS_X__ITEM_TYPE_NODEREV && item != NULL) { - node_revision_t *node = item; + svn_fs_x__noderev_t *node = item; const char *data_rep = node->data_rep ? apr_psprintf(scratch_pool, " d=%ld/%" APR_UINT64_T_FMT, @@ -180,33 +180,38 @@ aligned_seek(svn_fs_t *fs, apr_file_t *file, apr_off_t *buffer_start, apr_off_t offset, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; return svn_error_trace(svn_io_file_aligned_seek(file, ffd->block_size, buffer_start, offset, - pool)); + scratch_pool)); } /* Open the revision file for the item given by ID in filesystem FS and store the newly opened file in FILE. Seek to the item's location before - returning. Perform temporary allocations in POOL. */ + returning. + + Allocate the result in RESULT_POOL and temporaries in SCRATCH_POOL. */ static svn_error_t * open_and_seek_revision(svn_fs_x__revision_file_t **file, svn_fs_t *fs, - const svn_fs_x__id_part_t *id, - apr_pool_t *pool) + const svn_fs_x__id_t *id, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) { svn_fs_x__revision_file_t *rev_file; apr_off_t offset = -1; apr_uint32_t sub_item = 0; svn_revnum_t rev = svn_fs_x__get_revnum(id->change_set); - SVN_ERR(svn_fs_x__ensure_revision_exists(rev, fs, pool)); + SVN_ERR(svn_fs_x__ensure_revision_exists(rev, fs, scratch_pool)); - SVN_ERR(svn_fs_x__open_pack_or_rev_file(&rev_file, fs, rev, pool, pool)); - SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, rev_file, id, pool)); - SVN_ERR(aligned_seek(fs, rev_file->file, NULL, offset, pool)); + SVN_ERR(svn_fs_x__open_pack_or_rev_file(&rev_file, fs, rev, result_pool, + scratch_pool)); + SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, rev_file, id, + scratch_pool)); + SVN_ERR(aligned_seek(fs, rev_file->file, NULL, offset, scratch_pool)); *file = rev_file; @@ -214,46 +219,55 @@ open_and_seek_revision(svn_fs_x__revisio } /* Open the representation REP for a node-revision in filesystem FS, seek - to its position and store the newly opened file in FILE. Perform - temporary allocations in POOL. */ + to its position and store the newly opened file in FILE. + + Allocate the result in RESULT_POOL and temporaries in SCRATCH_POOL. */ static svn_error_t * open_and_seek_transaction(svn_fs_x__revision_file_t **file, svn_fs_t *fs, - representation_t *rep, - apr_pool_t *pool) + svn_fs_x__representation_t *rep, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) { apr_off_t offset; apr_uint32_t sub_item = 0; apr_int64_t txn_id = svn_fs_x__get_txn_id(rep->id.change_set); - SVN_ERR(svn_fs_x__open_proto_rev_file(file, fs, txn_id, pool, pool)); + SVN_ERR(svn_fs_x__open_proto_rev_file(file, fs, txn_id, result_pool, + scratch_pool)); SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, *file, &rep->id, - pool)); - SVN_ERR(aligned_seek(fs, (*file)->file, NULL, offset, pool)); + scratch_pool)); + SVN_ERR(aligned_seek(fs, (*file)->file, NULL, offset, scratch_pool)); return SVN_NO_ERROR; } /* Given a node-id ID, and a representation REP in filesystem FS, open the correct file and seek to the correction location. Store this - file in *FILE_P. Perform any allocations in POOL. */ + file in *FILE_P. + + Allocate the result in RESULT_POOL and temporaries in SCRATCH_POOL. */ static svn_error_t * open_and_seek_representation(svn_fs_x__revision_file_t **file_p, svn_fs_t *fs, - representation_t *rep, - apr_pool_t *pool) + svn_fs_x__representation_t *rep, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) { if (svn_fs_x__is_revision(rep->id.change_set)) - return open_and_seek_revision(file_p, fs, &rep->id, pool); + return open_and_seek_revision(file_p, fs, &rep->id, result_pool, + scratch_pool); else - return open_and_seek_transaction(file_p, fs, rep, pool); + return open_and_seek_transaction(file_p, fs, rep, result_pool, + scratch_pool); } static svn_error_t * -err_dangling_id(svn_fs_t *fs, const svn_fs_id_t *id) +err_dangling_id(svn_fs_t *fs, + const svn_fs_x__id_t *id) { svn_string_t *id_str = svn_fs_x__id_unparse(id, fs->pool); return svn_error_createf @@ -267,17 +281,17 @@ err_dangling_id(svn_fs_t *fs, const svn_ See svn_fs_x__get_node_revision, which wraps this and adds another error. */ static svn_error_t * -get_node_revision_body(node_revision_t **noderev_p, +get_node_revision_body(svn_fs_x__noderev_t **noderev_p, svn_fs_t *fs, - const svn_fs_id_t *id, + const svn_fs_x__id_t *id, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { svn_error_t *err; svn_boolean_t is_cached = FALSE; - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; - if (svn_fs_x__id_is_txn(id)) + if (svn_fs_x__is_txn(id->change_set)) { apr_file_t *file; @@ -310,9 +324,8 @@ get_node_revision_body(node_revision_t * svn_fs_x__revision_file_t *revision_file; /* noderevs in rev / pack files can be cached */ - const svn_fs_x__id_part_t *noderev_id = svn_fs_x__id_noderev_id(id); - svn_revnum_t revision = svn_fs_x__get_revnum(noderev_id->change_set); - pair_cache_key_t key; + svn_revnum_t revision = svn_fs_x__get_revnum(id->change_set); + svn_fs_x__pair_cache_key_t key; SVN_ERR(svn_fs_x__open_pack_or_rev_file(&revision_file, fs, revision, scratch_pool, scratch_pool)); @@ -324,7 +337,7 @@ get_node_revision_body(node_revision_t * apr_off_t offset; apr_uint32_t sub_item; SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, revision_file, - noderev_id, scratch_pool)); + id, scratch_pool)); key.revision = svn_fs_x__packed_base_rev(fs, revision); key.second = offset; @@ -337,7 +350,7 @@ get_node_revision_body(node_revision_t * } key.revision = revision; - key.second = noderev_id->number; + key.second = id->number; /* Not found or not applicable. Try a noderev cache lookup. * If that succeeds, we are done here. */ @@ -352,14 +365,10 @@ get_node_revision_body(node_revision_t * return SVN_NO_ERROR; } - /* read the data from disk */ - SVN_ERR(open_and_seek_revision(&revision_file, fs, noderev_id, - scratch_pool)); - /* block-read will parse the whole block and will also return the one noderev that we need right now. */ SVN_ERR(block_read((void **)noderev_p, fs, - noderev_id, + id, revision_file, result_pool, scratch_pool)); @@ -370,14 +379,12 @@ get_node_revision_body(node_revision_t * } svn_error_t * -svn_fs_x__get_node_revision(node_revision_t **noderev_p, +svn_fs_x__get_node_revision(svn_fs_x__noderev_t **noderev_p, svn_fs_t *fs, - const svn_fs_id_t *id, + const svn_fs_x__id_t *id, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - const svn_fs_x__id_part_t *noderev_id = svn_fs_x__id_noderev_id(id); - svn_error_t *err = get_node_revision_body(noderev_p, fs, id, result_pool, scratch_pool); if (err && err->apr_err == SVN_ERR_FS_CORRUPT) @@ -388,7 +395,7 @@ svn_fs_x__get_node_revision(node_revisio id_string->data); } - SVN_ERR(dgb__log_access(fs, noderev_id, *noderev_p, + SVN_ERR(dgb__log_access(fs, id, *noderev_p, SVN_FS_X__ITEM_TYPE_NODEREV, scratch_pool)); return svn_error_trace(err); @@ -398,44 +405,43 @@ svn_fs_x__get_node_revision(node_revisio svn_error_t * svn_fs_x__get_mergeinfo_count(apr_int64_t *count, svn_fs_t *fs, - const svn_fs_id_t *id, - apr_pool_t *pool) + const svn_fs_x__id_t *id, + apr_pool_t *scratch_pool) { - node_revision_t *noderev; + svn_fs_x__noderev_t *noderev; /* If we want a full acccess log, we need to provide full data and cannot take shortcuts here. */ #if !defined(SVN_FS_X__LOG_ACCESS) /* First, try a noderevs container cache lookup. */ - if (! svn_fs_x__id_is_txn(id)) + if (! svn_fs_x__is_txn(id->change_set)) { /* noderevs in rev / pack files can be cached */ - const svn_fs_x__id_part_t *noderev_id = svn_fs_x__id_noderev_id(id); - fs_x_data_t *ffd = fs->fsap_data; - svn_revnum_t revision = svn_fs_x__get_revnum(noderev_id->change_set); + svn_fs_x__data_t *ffd = fs->fsap_data; + svn_revnum_t revision = svn_fs_x__get_revnum(id->change_set); svn_fs_x__revision_file_t *rev_file; - SVN_ERR(svn_fs_x__open_pack_or_rev_file(&rev_file, fs, revision, pool, - pool)); + SVN_ERR(svn_fs_x__open_pack_or_rev_file(&rev_file, fs, revision, + scratch_pool, scratch_pool)); if ( svn_fs_x__is_packed_rev(fs, revision) && ffd->noderevs_container_cache) { - pair_cache_key_t key; + svn_fs_x__pair_cache_key_t key; apr_off_t offset; apr_uint32_t sub_item; svn_boolean_t is_cached; SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, rev_file, - noderev_id, pool)); + id, scratch_pool)); key.revision = svn_fs_x__packed_base_rev(fs, revision); key.second = offset; SVN_ERR(svn_cache__get_partial((void **)count, &is_cached, ffd->noderevs_container_cache, &key, svn_fs_x__mergeinfo_count_get_func, - &sub_item, pool)); + &sub_item, scratch_pool)); if (is_cached) return SVN_NO_ERROR; } @@ -443,7 +449,8 @@ svn_fs_x__get_mergeinfo_count(apr_int64_ #endif /* fallback to the naive implementation handling all edge cases */ - SVN_ERR(svn_fs_x__get_node_revision(&noderev, fs, id, pool, pool)); + SVN_ERR(svn_fs_x__get_node_revision(&noderev, fs, id, scratch_pool, + scratch_pool)); *count = noderev->mergeinfo_count; return SVN_NO_ERROR; @@ -451,14 +458,13 @@ svn_fs_x__get_mergeinfo_count(apr_int64_ svn_error_t * -svn_fs_x__rev_get_root(svn_fs_id_t **root_id_p, +svn_fs_x__rev_get_root(svn_fs_x__id_t *root_id, svn_fs_t *fs, svn_revnum_t rev, - apr_pool_t *result_pool, apr_pool_t *scratch_pool) { SVN_ERR(svn_fs_x__ensure_revision_exists(rev, fs, scratch_pool)); - *root_id_p = svn_fs_x__id_create_root(rev, result_pool); + svn_fs_x__init_rev_root(root_id, rev); return SVN_NO_ERROR; } @@ -494,7 +500,7 @@ typedef struct rep_state_t /* Caches un-deltified windows. May be NULL. */ svn_cache__t *combined_cache; /* ID addressing the representation */ - svn_fs_x__id_part_t rep_id; + svn_fs_x__id_t rep_id; /* length of the header at the start of the rep. 0 iff this is rep is stored in a container (i.e. does not have a header) */ @@ -515,11 +521,11 @@ typedef struct rep_state_t static svn_error_t * get_file_offset(apr_off_t *offset, rep_state_t *rs, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { return svn_error_trace(svn_fs_x__get_file_offset(offset, rs->sfile->rfile->file, - pool)); + scratch_pool)); } /* Simple wrapper around svn_io_file_aligned_seek to simplify callers. */ @@ -527,13 +533,13 @@ static svn_error_t * rs_aligned_seek(rep_state_t *rs, apr_off_t *buffer_start, apr_off_t offset, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = rs->sfile->fs->fsap_data; + svn_fs_x__data_t *ffd = rs->sfile->fs->fsap_data; return svn_error_trace(svn_io_file_aligned_seek(rs->sfile->rfile->file, ffd->block_size, buffer_start, offset, - pool)); + scratch_pool)); } /* Open FILE->FILE and FILE->STREAM if they haven't been opened, yet. */ @@ -549,15 +555,17 @@ auto_open_shared_file(shared_file_t *fil } /* Set RS->START to the begin of the representation raw in RS->SFILE->RFILE, - if that hasn't been done yet. Use POOL for temporary allocations. */ + if that hasn't been done yet. Use SCRATCH_POOL for temporary allocations. + */ static svn_error_t* -auto_set_start_offset(rep_state_t *rs, apr_pool_t *pool) +auto_set_start_offset(rep_state_t *rs, + apr_pool_t *scratch_pool) { if (rs->start == -1) { SVN_ERR(svn_fs_x__item_offset(&rs->start, &rs->sub_item, rs->sfile->fs, rs->sfile->rfile, - &rs->rep_id, pool)); + &rs->rep_id, scratch_pool)); rs->start += rs->header_size; } @@ -565,17 +573,19 @@ auto_set_start_offset(rep_state_t *rs, a } /* Set RS->VER depending on what is found in the already open RS->FILE->FILE - if the diff version is still unknown. Use POOL for temporary allocations. + if the diff version is still unknown. Use SCRATCH_POOL for temporary + allocations. */ static svn_error_t* -auto_read_diff_version(rep_state_t *rs, apr_pool_t *pool) +auto_read_diff_version(rep_state_t *rs, + apr_pool_t *scratch_pool) { if (rs->ver == -1) { char buf[4]; - SVN_ERR(rs_aligned_seek(rs, NULL, rs->start, pool)); + SVN_ERR(rs_aligned_seek(rs, NULL, rs->start, scratch_pool)); SVN_ERR(svn_io_file_read_full2(rs->sfile->rfile->file, buf, - sizeof(buf), NULL, NULL, pool)); + sizeof(buf), NULL, NULL, scratch_pool)); /* ### Layering violation */ if (! ((buf[0] == 'S') && (buf[1] == 'V') && (buf[2] == 'N'))) @@ -596,12 +606,12 @@ static svn_error_t * create_rep_state_body(rep_state_t **rep_state, svn_fs_x__rep_header_t **rep_header, shared_file_t **shared_file, - representation_t *rep, + svn_fs_x__representation_t *rep, svn_fs_t *fs, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; rep_state_t *rs = apr_pcalloc(result_pool, sizeof(*rs)); svn_fs_x__rep_header_t *rh; svn_boolean_t is_cached = FALSE; @@ -624,7 +634,7 @@ create_rep_state_body(rep_state_t **rep_ && ( ((*shared_file)->revision / ffd->max_files_per_dir) == (revision / ffd->max_files_per_dir)); - representation_cache_key_t key; + svn_fs_x__representation_cache_key_t key; key.revision = revision; key.is_packed = revision < ffd->min_unpacked_rev; key.item_index = rep->id.number; @@ -701,7 +711,7 @@ create_rep_state_body(rep_state_t **rep_ * an in-txn file. */ SVN_ERR(open_and_seek_representation(&rs->sfile->rfile, fs, rep, - result_pool)); + result_pool, scratch_pool)); } if (SVN_IS_VALID_REVNUM(revision)) @@ -782,7 +792,7 @@ static svn_error_t * create_rep_state(rep_state_t **rep_state, svn_fs_x__rep_header_t **rep_header, shared_file_t **shared_file, - representation_t *rep, + svn_fs_x__representation_t *rep, svn_fs_t *fs, apr_pool_t *result_pool, apr_pool_t *scratch_pool) @@ -812,7 +822,7 @@ create_rep_state(rep_state_t **rep_state } svn_error_t * -svn_fs_x__check_rep(representation_t *rep, +svn_fs_x__check_rep(svn_fs_x__representation_t *rep, svn_fs_t *fs, apr_pool_t *scratch_pool) { @@ -856,11 +866,11 @@ svn_fs_x__check_rep(representation_t *re svn_error_t * svn_fs_x__rep_chain_length(int *chain_length, int *shard_count, - representation_t *rep, + svn_fs_x__representation_t *rep, svn_fs_t *fs, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_revnum_t shard_size = ffd->max_files_per_dir; svn_boolean_t is_delta = FALSE; int count = 0; @@ -877,7 +887,7 @@ svn_fs_x__rep_chain_length(int *chain_le /* Check whether the length of the deltification chain is acceptable. * Otherwise, shared reps may form a non-skipping delta chain in * extreme cases. */ - representation_t base_rep = *rep; + svn_fs_x__representation_t base_rep = *rep; /* re-use open files between iterations */ shared_file_t *file_hint = NULL; @@ -943,7 +953,7 @@ struct rep_read_baton svn_fs_t *fs; /* Representation to read. */ - representation_t rep; + svn_fs_x__representation_t rep; /* If not NULL, this is the base for the first delta window in rs_list */ svn_stringbuf_t *base_window; @@ -980,7 +990,7 @@ struct rep_read_baton /* The key for the fulltext cache for this rep, if there is a fulltext cache. */ - pair_cache_key_t fulltext_cache_key; + svn_fs_x__pair_cache_key_t fulltext_cache_key; /* The text we've been reading, if we're going to cache it. */ svn_stringbuf_t *current_fulltext; @@ -994,7 +1004,7 @@ struct rep_read_baton svn_filesize_t fulltext_delivered; /* Used for temporary allocations during the read. */ - apr_pool_t *pool; + apr_pool_t *scratch_pool; /* Pool used to store file handles and other data that is persistant for the entire stream read. */ @@ -1003,8 +1013,9 @@ struct rep_read_baton /* Set window key in *KEY to address the window described by RS. For convenience, return the KEY. */ -static window_cache_key_t * -get_window_key(window_cache_key_t *key, rep_state_t *rs) +static svn_fs_x__window_cache_key_t * +get_window_key(svn_fs_x__window_cache_key_t *key, + rep_state_t *rs) { svn_revnum_t revision = svn_fs_x__get_revnum(rs->rep_id.change_set); assert(revision <= APR_UINT32_MAX); @@ -1083,7 +1094,7 @@ get_cached_window_sizes(window_sizes_t * } else { - window_cache_key_t key = { 0 }; + svn_fs_x__window_cache_key_t key = { 0 }; SVN_ERR(svn_cache__get_partial((void **)sizes, is_cached, rs->window_cache, @@ -1113,7 +1124,7 @@ get_cached_window(svn_txdelta_window_t * { /* ask the cache for the desired txdelta window */ svn_fs_x__txdelta_cached_window_t *cached_window; - window_cache_key_t key = { 0 }; + svn_fs_x__window_cache_key_t key = { 0 }; get_window_key(&key, rs); key.chunk_index = chunk_index; SVN_ERR(svn_cache__get((void **) &cached_window, @@ -1150,7 +1161,7 @@ set_cached_window(svn_txdelta_window_t * { /* store the window and the first offset _past_ it */ svn_fs_x__txdelta_cached_window_t cached_window; - window_cache_key_t key = {0}; + svn_fs_x__window_cache_key_t key = {0}; cached_window.window = window; cached_window.start_offset = start_offset - rs->start; @@ -1187,7 +1198,7 @@ get_cached_combined_window(svn_stringbuf else { /* ask the cache for the desired txdelta window */ - window_cache_key_t key = { 0 }; + svn_fs_x__window_cache_key_t key = { 0 }; return svn_cache__get((void **)window_p, is_cached, rs->combined_cache, @@ -1210,7 +1221,7 @@ set_cached_combined_window(svn_stringbuf { /* but key it with the start offset because that is the known state * when we will look it up */ - window_cache_key_t key = { 0 }; + svn_fs_x__window_cache_key_t key = { 0 }; return svn_cache__set(rs->combined_cache, get_window_key(&key, rs), window, @@ -1235,22 +1246,23 @@ build_rep_list(apr_array_header_t **list svn_stringbuf_t **window_p, rep_state_t **src_state, svn_fs_t *fs, - representation_t *first_rep, - apr_pool_t *pool) + svn_fs_x__representation_t *first_rep, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) { - representation_t rep; + svn_fs_x__representation_t rep; rep_state_t *rs = NULL; svn_fs_x__rep_header_t *rep_header; svn_boolean_t is_cached = FALSE; shared_file_t *shared_file = NULL; - apr_pool_t *iterpool = svn_pool_create(pool); + apr_pool_t *iterpool = svn_pool_create(scratch_pool); - *list = apr_array_make(pool, 1, sizeof(rep_state_t *)); + *list = apr_array_make(result_pool, 1, sizeof(rep_state_t *)); rep = *first_rep; /* for the top-level rep, we need the rep_args */ - SVN_ERR(create_rep_state(&rs, &rep_header, &shared_file, &rep, fs, pool, - iterpool)); + SVN_ERR(create_rep_state(&rs, &rep_header, &shared_file, &rep, fs, + result_pool, iterpool)); while (1) { @@ -1259,13 +1271,14 @@ build_rep_list(apr_array_header_t **list /* fetch state, if that has not been done already */ if (!rs) SVN_ERR(create_rep_state(&rs, &rep_header, &shared_file, - &rep, fs, pool, iterpool)); + &rep, fs, result_pool, iterpool)); /* for txn reps and containered reps, there won't be a cached * combined window */ if (svn_fs_x__is_revision(rep.id.change_set) && rep_header->type != svn_fs_x__rep_container) - SVN_ERR(get_cached_combined_window(window_p, rs, &is_cached, pool)); + SVN_ERR(get_cached_combined_window(window_p, rs, &is_cached, + result_pool)); if (is_cached) { @@ -1309,31 +1322,39 @@ build_rep_list(apr_array_header_t **list /* Create a rep_read_baton structure for node revision NODEREV in filesystem FS and store it in *RB_P. If FULLTEXT_CACHE_KEY is not NULL, it is the rep's key in the fulltext cache, and a stringbuf - must be allocated to store the text. Perform all allocations in - POOL. If rep is mutable, it must be for file contents. */ + must be allocated to store the text. If rep is mutable, it must be + refer to file contents. + + Allocate the result in RESULT_POOL. This includes the pools within *RB_P. + */ static svn_error_t * rep_read_get_baton(struct rep_read_baton **rb_p, svn_fs_t *fs, - representation_t *rep, - pair_cache_key_t fulltext_cache_key, - apr_pool_t *pool) + svn_fs_x__representation_t *rep, + svn_fs_x__pair_cache_key_t fulltext_cache_key, + apr_pool_t *result_pool) { struct rep_read_baton *b; - b = apr_pcalloc(pool, sizeof(*b)); + b = apr_pcalloc(result_pool, sizeof(*b)); b->fs = fs; b->rep = *rep; b->base_window = NULL; b->chunk_index = 0; b->buf = NULL; - b->md5_checksum_ctx = svn_checksum_ctx_create(svn_checksum_md5, pool); + b->md5_checksum_ctx = svn_checksum_ctx_create(svn_checksum_md5, + result_pool); b->checksum_finalized = FALSE; memcpy(b->md5_digest, rep->md5_digest, sizeof(rep->md5_digest)); b->len = rep->expanded_size; b->off = 0; b->fulltext_cache_key = fulltext_cache_key; - b->pool = svn_pool_create(pool); - b->filehandle_pool = svn_pool_create(pool); + + /* Clearable sub-pools. Since they have to remain valid for as long as B + lives, we can't take them from some scratch pool. The caller of this + function will have no control over how those subpools will be used. */ + b->scratch_pool = svn_pool_create(result_pool); + b->filehandle_pool = svn_pool_create(result_pool); b->fulltext_cache = NULL; b->fulltext_delivered = 0; b->current_fulltext = NULL; @@ -1446,8 +1467,8 @@ read_container_window(svn_stringbuf_t ** { svn_fs_x__rep_extractor_t *extractor = NULL; svn_fs_t *fs = rs->sfile->fs; - fs_x_data_t *ffd = fs->fsap_data; - pair_cache_key_t key; + svn_fs_x__data_t *ffd = fs->fsap_data; + svn_fs_x__pair_cache_key_t key; svn_revnum_t revision = svn_fs_x__get_revnum(rs->rep_id.change_set); SVN_ERR(auto_set_start_offset(rs, scratch_pool)); @@ -1503,9 +1524,9 @@ get_combined_window(svn_stringbuf_t **re the size of each window is relatively small (100kB) and skip- delta limits the number of deltas in a chain to well under 100. Stop early if one of them does not depend on its predecessors. */ - window_pool = svn_pool_create(rb->pool); + window_pool = svn_pool_create(rb->scratch_pool); windows = apr_array_make(window_pool, 0, sizeof(svn_txdelta_window_t *)); - iterpool = svn_pool_create(rb->pool); + iterpool = svn_pool_create(rb->scratch_pool); for (i = 0; i < rb->rs_list->nelts; ++i) { svn_txdelta_window_t *window; @@ -1525,7 +1546,7 @@ get_combined_window(svn_stringbuf_t **re } /* Combine in the windows from the other delta reps. */ - pool = svn_pool_create(rb->pool); + pool = svn_pool_create(rb->scratch_pool); for (--i; i >= 0; --i) { svn_txdelta_window_t *window; @@ -1545,7 +1566,7 @@ get_combined_window(svn_stringbuf_t **re window->sview_len, pool, iterpool)); /* Combine this window with the current one. */ - new_pool = svn_pool_create(rb->pool); + new_pool = svn_pool_create(rb->scratch_pool); buf = svn_stringbuf_create_ensure(window->tview_len, new_pool); buf->len = window->tview_len; @@ -1581,7 +1602,8 @@ get_combined_window(svn_stringbuf_t **re * based on its size SIZE. The decision depends on the cache used by RB. */ static svn_boolean_t -fulltext_size_is_cachable(fs_x_data_t *ffd, svn_filesize_t size) +fulltext_size_is_cachable(svn_fs_x__data_t *ffd, + svn_filesize_t size) { return (size < APR_SIZE_MAX) && svn_cache__is_cachable(ffd->fulltext_cache, (apr_size_t)size); @@ -1594,7 +1616,7 @@ rep_read_contents_close(void *baton) { struct rep_read_baton *rb = baton; - svn_pool_destroy(rb->pool); + svn_pool_destroy(rb->scratch_pool); svn_pool_destroy(rb->filehandle_pool); return SVN_NO_ERROR; @@ -1612,7 +1634,7 @@ init_rep_state(rep_state_t *rs, svn_fs_x__p2l_entry_t* entry, apr_pool_t *pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; shared_file_t *shared_file = apr_pcalloc(pool, sizeof(*shared_file)); /* this function does not apply to representation containers */ @@ -1725,10 +1747,10 @@ static svn_error_t * read_rep_header(svn_fs_x__rep_header_t **rep_header, svn_fs_t *fs, svn_stream_t *stream, - representation_cache_key_t *key, + svn_fs_x__representation_cache_key_t *key, apr_pool_t *pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_boolean_t is_cached = FALSE; if (ffd->rep_header_cache) @@ -1753,9 +1775,9 @@ svn_fs_x__get_representation_length(svn_ svn_fs_t *fs, svn_fs_x__revision_file_t *rev_file, svn_fs_x__p2l_entry_t* entry, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { - representation_cache_key_t key = { 0 }; + svn_fs_x__representation_cache_key_t key = { 0 }; rep_state_t rs = { 0 }; svn_fs_x__rep_header_t *rep_header; @@ -1768,15 +1790,17 @@ svn_fs_x__get_representation_length(svn_ key.revision = svn_fs_x__get_revnum(entry->items[0].change_set); key.is_packed = svn_fs_x__is_packed_rev(fs, key.revision); key.item_index = entry->items[0].number; - SVN_ERR(read_rep_header(&rep_header, fs, rev_file->stream, &key, pool)); + SVN_ERR(read_rep_header(&rep_header, fs, rev_file->stream, &key, + scratch_pool)); /* prepare representation reader state (rs) structure */ - SVN_ERR(init_rep_state(&rs, rep_header, fs, rev_file, entry, pool)); - + SVN_ERR(init_rep_state(&rs, rep_header, fs, rev_file, entry, + scratch_pool)); + /* RS->SFILE may be shared between RS instances -> make sure we point * to the right data. */ *packed_len = rs.size; - SVN_ERR(cache_windows(expanded_len, fs, &rs, -1, pool)); + SVN_ERR(cache_windows(expanded_len, fs, &rs, -1, scratch_pool)); return SVN_NO_ERROR; } @@ -1805,8 +1829,8 @@ get_contents_from_windows(struct rep_rea /* RS->SIZE is unreliable here because it is based upon * the delta rep size _before_ putting the data into a * a container. */ - SVN_ERR(read_container_window(&rb->base_window, rs, - rb->len, rb->pool, rb->pool)); + SVN_ERR(read_container_window(&rb->base_window, rs, rb->len, + rb->scratch_pool, rb->scratch_pool)); rs->current -= rb->base_window->len; } @@ -1849,7 +1873,7 @@ get_contents_from_windows(struct rep_rea local pool. */ if (rb->buf_pos == rb->buf_len) { - svn_pool_clear(rb->pool); + svn_pool_clear(rb->scratch_pool); rb->buf = NULL; } } @@ -1946,7 +1970,7 @@ get_contents_from_fulltext(svn_boolean_t SVN_ERR(svn_cache__get_partial(&dummy, cached, baton->fulltext_cache, &baton->fulltext_cache_key, get_fulltext_partial, &fulltext_baton, - baton->pool)); + baton->scratch_pool)); if (*cached) { @@ -2043,7 +2067,7 @@ skip_contents(struct rep_read_baton *bat else if (len > 0) { /* Simply drain LEN bytes from the window stream. */ - apr_pool_t *subpool = subpool = svn_pool_create(baton->pool); + apr_pool_t *subpool = subpool = svn_pool_create(baton->scratch_pool); char *buffer = apr_palloc(subpool, SVN__STREAM_CHUNK_SIZE); while (len > 0 && !err) @@ -2091,7 +2115,7 @@ rep_read_contents(void *baton, /* Window stream not initialized, yet. Do it now. */ SVN_ERR(build_rep_list(&rb->rs_list, &rb->base_window, &rb->src_state, rb->fs, &rb->rep, - rb->filehandle_pool)); + rb->filehandle_pool, rb->scratch_pool)); /* In case we did read from the fulltext cache before, make the * window stream catch up. Also, initialize the fulltext buffer @@ -2122,11 +2146,11 @@ rep_read_contents(void *baton, rb->checksum_finalized = TRUE; SVN_ERR(svn_checksum_final(&md5_checksum, rb->md5_checksum_ctx, - rb->pool)); + rb->scratch_pool)); if (!svn_checksum_match(md5_checksum, &expected)) return svn_error_create(SVN_ERR_FS_CORRUPT, svn_checksum_mismatch_err(&expected, md5_checksum, - rb->pool, + rb->scratch_pool, _("Checksum mismatch while reading representation")), NULL); } @@ -2134,9 +2158,9 @@ rep_read_contents(void *baton, if (rb->off == rb->len && rb->current_fulltext) { - fs_x_data_t *ffd = rb->fs->fsap_data; + svn_fs_x__data_t *ffd = rb->fs->fsap_data; SVN_ERR(svn_cache__set(ffd->fulltext_cache, &rb->fulltext_cache_key, - rb->current_fulltext, rb->pool)); + rb->current_fulltext, rb->scratch_pool)); rb->current_fulltext = NULL; } @@ -2146,28 +2170,29 @@ rep_read_contents(void *baton, svn_error_t * svn_fs_x__get_contents(svn_stream_t **contents_p, svn_fs_t *fs, - representation_t *rep, + svn_fs_x__representation_t *rep, svn_boolean_t cache_fulltext, - apr_pool_t *pool) + apr_pool_t *result_pool) { if (! rep) { - *contents_p = svn_stream_empty(pool); + *contents_p = svn_stream_empty(result_pool); } else { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_filesize_t len = rep->expanded_size; struct rep_read_baton *rb; svn_revnum_t revision = svn_fs_x__get_revnum(rep->id.change_set); - pair_cache_key_t fulltext_cache_key = { 0 }; + svn_fs_x__pair_cache_key_t fulltext_cache_key = { 0 }; fulltext_cache_key.revision = revision; fulltext_cache_key.second = rep->id.number; /* Initialize the reader baton. Some members may added lazily * while reading from the stream */ - SVN_ERR(rep_read_get_baton(&rb, fs, rep, fulltext_cache_key, pool)); + SVN_ERR(rep_read_get_baton(&rb, fs, rep, fulltext_cache_key, + result_pool)); /* Make the stream attempt fulltext cache lookups if the fulltext * is cacheable. If it is not, then also don't try to buffer and @@ -2185,7 +2210,7 @@ svn_fs_x__get_contents(svn_stream_t **co rb->fulltext_cache_key.revision = SVN_INVALID_REVNUM; } - *contents_p = svn_stream_create(rb, pool); + *contents_p = svn_stream_create(rb, result_pool); svn_stream_set_read2(*contents_p, NULL /* only full read support */, rep_read_contents); svn_stream_set_close(*contents_p, rep_read_contents_close); @@ -2230,16 +2255,16 @@ cache_access_wrapper(void **out, svn_error_t * svn_fs_x__try_process_file_contents(svn_boolean_t *success, svn_fs_t *fs, - node_revision_t *noderev, + svn_fs_x__noderev_t *noderev, svn_fs_process_contents_func_t processor, void* baton, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { - representation_t *rep = noderev->data_rep; + svn_fs_x__representation_t *rep = noderev->data_rep; if (rep) { - fs_x_data_t *ffd = fs->fsap_data; - pair_cache_key_t fulltext_cache_key = { 0 }; + svn_fs_x__data_t *ffd = fs->fsap_data; + svn_fs_x__pair_cache_key_t fulltext_cache_key = { 0 }; fulltext_cache_key.revision = svn_fs_x__get_revnum(rep->id.change_set); fulltext_cache_key.second = rep->id.number; @@ -2257,7 +2282,7 @@ svn_fs_x__try_process_file_contents(svn_ &fulltext_cache_key, cache_access_wrapper, &wrapper_baton, - pool); + scratch_pool); } } @@ -2274,7 +2299,8 @@ struct delta_read_baton /* This implements the svn_txdelta_next_window_fn_t interface. */ static svn_error_t * -delta_read_next_window(svn_txdelta_window_t **window, void *baton, +delta_read_next_window(svn_txdelta_window_t **window, + void *baton, apr_pool_t *pool) { struct delta_read_baton *drb = baton; @@ -2306,7 +2332,7 @@ delta_read_md5_digest(void *baton) */ static svn_txdelta_stream_t * get_storaged_delta_stream(rep_state_t *rep_state, - node_revision_t *target, + svn_fs_x__noderev_t *target, apr_pool_t *pool) { /* Create the delta read baton. */ @@ -2321,14 +2347,14 @@ get_storaged_delta_stream(rep_state_t *r svn_error_t * svn_fs_x__get_file_delta_stream(svn_txdelta_stream_t **stream_p, svn_fs_t *fs, - node_revision_t *source, - node_revision_t *target, + svn_fs_x__noderev_t *source, + svn_fs_x__noderev_t *target, apr_pool_t *pool) { svn_stream_t *source_stream, *target_stream; rep_state_t *rep_state; svn_fs_x__rep_header_t *rep_header; - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; /* Try a shortcut: if the target is stored as a delta against the source, then just use that delta. However, prefer using the fulltext cache @@ -2392,14 +2418,14 @@ svn_fs_x__get_file_delta_stream(svn_txde return SVN_NO_ERROR; } -/* Return TRUE when all svn_fs_dirent_t* in ENTRIES are already sorted +/* Return TRUE when all svn_fs_x__dirent_t* in ENTRIES are already sorted by their respective name. */ static svn_boolean_t sorted(apr_array_header_t *entries) { int i; - const svn_fs_dirent_t * const *dirents = (const void *)entries->elts; + const svn_fs_x__dirent_t * const *dirents = (const void *)entries->elts; for (i = 0; i < entries->nelts-1; ++i) if (strcmp(dirents[i]->name, dirents[i+1]->name) > 0) return FALSE; @@ -2409,19 +2435,21 @@ sorted(apr_array_header_t *entries) /* Compare the names of the two dirents given in **A and **B. */ static int -compare_dirents(const void *a, const void *b) +compare_dirents(const void *a, + const void *b) { - const svn_fs_dirent_t *lhs = *((const svn_fs_dirent_t * const *) a); - const svn_fs_dirent_t *rhs = *((const svn_fs_dirent_t * const *) b); + const svn_fs_x__dirent_t *lhs = *((const svn_fs_x__dirent_t * const *) a); + const svn_fs_x__dirent_t *rhs = *((const svn_fs_x__dirent_t * const *) b); return strcmp(lhs->name, rhs->name); } /* Compare the name of the dirents given in **A with the C string in *B. */ static int -compare_dirent_name(const void *a, const void *b) +compare_dirent_name(const void *a, + const void *b) { - const svn_fs_dirent_t *lhs = *((const svn_fs_dirent_t * const *) a); + const svn_fs_x__dirent_t *lhs = *((const svn_fs_x__dirent_t * const *) a); const char *rhs = b; return strcmp(lhs->name, rhs); @@ -2435,7 +2463,7 @@ static svn_error_t * read_dir_entries(apr_array_header_t *entries, svn_stream_t *stream, svn_boolean_t incremental, - const svn_fs_id_t *id, + const svn_fs_x__id_t *id, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { @@ -2449,7 +2477,7 @@ read_dir_entries(apr_array_header_t *ent while (1) { svn_hash__entry_t entry; - svn_fs_dirent_t *dirent; + svn_fs_x__dirent_t *dirent; char *str; svn_pool_clear(iterpool); @@ -2483,8 +2511,8 @@ read_dir_entries(apr_array_header_t *ent str = svn_cstring_tokenize(" ", &entry.val); if (str == NULL) return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL, - _("Directory entry corrupt in '%s'"), - svn_fs_x__id_unparse(id, scratch_pool)->data); + _("Directory entry corrupt in '%s'"), + svn_fs_x__id_unparse(id, scratch_pool)->data); if (strcmp(str, SVN_FS_X__KIND_FILE) == 0) { @@ -2497,24 +2525,24 @@ read_dir_entries(apr_array_header_t *ent else { return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL, - _("Directory entry corrupt in '%s'"), - svn_fs_x__id_unparse(id, scratch_pool)->data); + _("Directory entry corrupt in '%s'"), + svn_fs_x__id_unparse(id, scratch_pool)->data); } str = svn_cstring_tokenize(" ", &entry.val); if (str == NULL) return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL, - _("Directory entry corrupt in '%s'"), - svn_fs_x__id_unparse(id, scratch_pool)->data); + _("Directory entry corrupt in '%s'"), + svn_fs_x__id_unparse(id, scratch_pool)->data); - SVN_ERR(svn_fs_x__id_parse(&dirent->id, str, result_pool)); + SVN_ERR(svn_fs_x__id_parse(&dirent->id, str)); /* In incremental mode, update the hash; otherwise, write to the * final array. */ if (incremental) apr_hash_set(hash, entry.key, entry.keylen, dirent); else - APR_ARRAY_PUSH(entries, svn_fs_dirent_t *) = dirent; + APR_ARRAY_PUSH(entries, svn_fs_x__dirent_t *) = dirent; } /* Convert container to a sorted array. */ @@ -2522,7 +2550,7 @@ read_dir_entries(apr_array_header_t *ent { apr_hash_index_t *hi; for (hi = apr_hash_first(iterpool, hash); hi; hi = apr_hash_next(hi)) - APR_ARRAY_PUSH(entries, svn_fs_dirent_t *) = apr_hash_this_val(hi); + APR_ARRAY_PUSH(entries, svn_fs_x__dirent_t *) = apr_hash_this_val(hi); } if (!sorted(entries)) @@ -2535,29 +2563,30 @@ read_dir_entries(apr_array_header_t *ent /* Fetch the contents of a directory into ENTRIES. Values are stored as filename to string mappings; further conversion is necessary to - convert them into svn_fs_dirent_t values. */ + convert them into svn_fs_x__dirent_t values. */ static svn_error_t * get_dir_contents(apr_array_header_t **entries, svn_fs_t *fs, - node_revision_t *noderev, + svn_fs_x__noderev_t *noderev, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { svn_stream_t *contents; + const svn_fs_x__id_t *id = &noderev->noderev_id; - *entries = apr_array_make(result_pool, 16, sizeof(svn_fs_dirent_t *)); + *entries = apr_array_make(result_pool, 16, sizeof(svn_fs_x__dirent_t *)); if (noderev->data_rep && ! svn_fs_x__is_revision(noderev->data_rep->id.change_set)) { const char *filename - = svn_fs_x__path_txn_node_children(fs, noderev->id, scratch_pool); + = svn_fs_x__path_txn_node_children(fs, id, scratch_pool); /* The representation is mutable. Read the old directory contents from the mutable children file, followed by the changes we've made in this transaction. */ SVN_ERR(svn_stream_open_readonly(&contents, filename, scratch_pool, scratch_pool)); - SVN_ERR(read_dir_entries(*entries, contents, TRUE, noderev->id, + SVN_ERR(read_dir_entries(*entries, contents, TRUE, id, result_pool, scratch_pool)); SVN_ERR(svn_stream_close(contents)); } @@ -2577,7 +2606,7 @@ get_dir_contents(apr_array_header_t **en /* de-serialize hash */ contents = svn_stream_from_stringbuf(text, scratch_pool); - SVN_ERR(read_dir_entries(*entries, contents, FALSE, noderev->id, + SVN_ERR(read_dir_entries(*entries, contents, FALSE, id, result_pool, scratch_pool)); } @@ -2590,16 +2619,15 @@ get_dir_contents(apr_array_header_t **en */ static svn_cache__t * locate_dir_cache(svn_fs_t *fs, - svn_fs_x__id_part_t *key, - node_revision_t *noderev, - apr_pool_t *pool) + svn_fs_x__id_t *key, + svn_fs_x__noderev_t *noderev) { - fs_x_data_t *ffd = fs->fsap_data; - if (svn_fs_x__id_is_txn(noderev->id)) + svn_fs_x__data_t *ffd = fs->fsap_data; + if (svn_fs_x__is_txn(noderev->noderev_id.change_set)) { /* data in txns must be addressed by ID since the representation has not been created, yet. */ - *key = *svn_fs_x__id_noderev_id(noderev->id); + *key = noderev->noderev_id; } else { @@ -2623,14 +2651,14 @@ locate_dir_cache(svn_fs_t *fs, svn_error_t * svn_fs_x__rep_contents_dir(apr_array_header_t **entries_p, svn_fs_t *fs, - node_revision_t *noderev, + svn_fs_x__noderev_t *noderev, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - svn_fs_x__id_part_t key; + svn_fs_x__id_t key; /* find the cache we may use */ - svn_cache__t *cache = locate_dir_cache(fs, &key, noderev, scratch_pool); + svn_cache__t *cache = locate_dir_cache(fs, &key, noderev); if (cache) { svn_boolean_t found; @@ -2652,20 +2680,20 @@ svn_fs_x__rep_contents_dir(apr_array_hea return SVN_NO_ERROR; } -svn_fs_dirent_t * +svn_fs_x__dirent_t * svn_fs_x__find_dir_entry(apr_array_header_t *entries, const char *name, int *hint) { - svn_fs_dirent_t **result + svn_fs_x__dirent_t **result = svn_sort__array_lookup(entries, name, hint, compare_dirent_name); return result ? *result : NULL; } svn_error_t * -svn_fs_x__rep_contents_dir_entry(svn_fs_dirent_t **dirent, +svn_fs_x__rep_contents_dir_entry(svn_fs_x__dirent_t **dirent, svn_fs_t *fs, - node_revision_t *noderev, + svn_fs_x__noderev_t *noderev, const char *name, apr_pool_t *result_pool, apr_pool_t *scratch_pool) @@ -2673,8 +2701,8 @@ svn_fs_x__rep_contents_dir_entry(svn_fs_ svn_boolean_t found = FALSE; /* find the cache we may use */ - svn_fs_x__id_part_t key; - svn_cache__t *cache = locate_dir_cache(fs, &key, noderev, scratch_pool); + svn_fs_x__id_t key; + svn_cache__t *cache = locate_dir_cache(fs, &key, noderev); if (cache) { /* Cache lookup. */ @@ -2691,8 +2719,8 @@ svn_fs_x__rep_contents_dir_entry(svn_fs_ if (! found) { apr_array_header_t *entries; - svn_fs_dirent_t *entry; - svn_fs_dirent_t *entry_copy = NULL; + svn_fs_x__dirent_t *entry; + svn_fs_x__dirent_t *entry_copy = NULL; /* read the dir from the file system. It will probably be put it into the cache for faster lookup in future calls. */ @@ -2703,10 +2731,8 @@ svn_fs_x__rep_contents_dir_entry(svn_fs_ entry = svn_fs_x__find_dir_entry(entries, name, NULL); if (entry) { - entry_copy = apr_palloc(result_pool, sizeof(*entry_copy)); + entry_copy = apr_pmemdup(result_pool, entry, sizeof(*entry_copy)); entry_copy->name = apr_pstrdup(result_pool, entry->name); - entry_copy->id = svn_fs_x__id_copy(entry->id, result_pool); - entry_copy->kind = entry->kind; } *dirent = entry_copy; @@ -2718,17 +2744,18 @@ svn_fs_x__rep_contents_dir_entry(svn_fs_ svn_error_t * svn_fs_x__get_proplist(apr_hash_t **proplist_p, svn_fs_t *fs, - node_revision_t *noderev, + svn_fs_x__noderev_t *noderev, apr_pool_t *pool) { apr_hash_t *proplist; svn_stream_t *stream; + const svn_fs_x__id_t *noderev_id = &noderev->noderev_id; if (noderev->prop_rep && !svn_fs_x__is_revision(noderev->prop_rep->id.change_set)) { const char *filename - = svn_fs_x__path_txn_node_props(fs, noderev->id, pool); + = svn_fs_x__path_txn_node_props(fs, noderev_id, pool); proplist = apr_hash_make(pool); SVN_ERR(svn_stream_open_readonly(&stream, filename, pool, pool)); @@ -2737,9 +2764,9 @@ svn_fs_x__get_proplist(apr_hash_t **prop } else if (noderev->prop_rep) { - fs_x_data_t *ffd = fs->fsap_data; - representation_t *rep = noderev->prop_rep; - pair_cache_key_t key = { 0 }; + svn_fs_x__data_t *ffd = fs->fsap_data; + svn_fs_x__representation_t *rep = noderev->prop_rep; + svn_fs_x__pair_cache_key_t key = { 0 }; key.revision = svn_fs_x__get_revnum(rep->id.change_set); key.second = rep->id.number; @@ -2782,10 +2809,10 @@ svn_fs_x__get_changes(apr_array_header_t { svn_fs_x__revision_file_t *revision_file; svn_boolean_t found; - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; apr_pool_t *scratch_pool = svn_pool_create(result_pool); - svn_fs_x__id_part_t id; + svn_fs_x__id_t id; id.change_set = svn_fs_x__change_set_by_rev(rev); id.number = SVN_FS_X__ITEM_INDEX_CHANGES; @@ -2801,7 +2828,7 @@ svn_fs_x__get_changes(apr_array_header_t { apr_off_t offset; apr_uint32_t sub_item; - pair_cache_key_t key; + svn_fs_x__pair_cache_key_t key; SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, revision_file, &id, scratch_pool)); @@ -2849,12 +2876,12 @@ static svn_error_t * block_read_contents(svn_fs_t *fs, svn_fs_x__revision_file_t *rev_file, svn_fs_x__p2l_entry_t* entry, - pair_cache_key_t *key, + svn_fs_x__pair_cache_key_t *key, apr_off_t max_offset, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; - representation_cache_key_t header_key = { 0 }; + svn_fs_x__data_t *ffd = fs->fsap_data; + svn_fs_x__representation_cache_key_t header_key = { 0 }; rep_state_t rs = { 0 }; svn_filesize_t fulltext_len; svn_fs_x__rep_header_t *rep_header; @@ -2936,7 +2963,7 @@ block_read_changes(apr_array_header_t ** apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_stream_t *stream; svn_revnum_t revision = svn_fs_x__get_revnum(entry->items[0].change_set); if (!must_read && !ffd->changes_cache) @@ -2990,9 +3017,9 @@ block_read_changes_container(apr_array_h apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_fs_x__changes_t *container; - pair_cache_key_t key; + svn_fs_x__pair_cache_key_t key; svn_stream_t *stream; svn_revnum_t revision = svn_fs_x__get_revnum(entry->items[0].change_set); @@ -3030,16 +3057,16 @@ block_read_changes_container(apr_array_h } static svn_error_t * -block_read_noderev(node_revision_t **noderev_p, +block_read_noderev(svn_fs_x__noderev_t **noderev_p, svn_fs_t *fs, svn_fs_x__revision_file_t *rev_file, svn_fs_x__p2l_entry_t* entry, - pair_cache_key_t *key, + svn_fs_x__pair_cache_key_t *key, svn_boolean_t must_read, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_stream_t *stream; if (!must_read && !ffd->node_revision_cache) return SVN_NO_ERROR; @@ -3075,7 +3102,7 @@ block_read_noderev(node_revision_t **nod } static svn_error_t * -block_read_noderevs_container(node_revision_t **noderev_p, +block_read_noderevs_container(svn_fs_x__noderev_t **noderev_p, svn_fs_t *fs, svn_fs_x__revision_file_t *rev_file, svn_fs_x__p2l_entry_t* entry, @@ -3084,10 +3111,10 @@ block_read_noderevs_container(node_revis apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_fs_x__noderevs_t *container; svn_stream_t *stream; - pair_cache_key_t key; + svn_fs_x__pair_cache_key_t key; svn_revnum_t revision = svn_fs_x__get_revnum(entry->items[0].change_set); key.revision = svn_fs_x__packed_base_rev(fs, revision); @@ -3131,10 +3158,10 @@ block_read_reps_container(svn_fs_x__rep_ apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_fs_x__reps_t *container; svn_stream_t *stream; - pair_cache_key_t key; + svn_fs_x__pair_cache_key_t key; svn_revnum_t revision = svn_fs_x__get_revnum(entry->items[0].change_set); key.revision = svn_fs_x__packed_base_rev(fs, revision); @@ -3172,12 +3199,12 @@ block_read_reps_container(svn_fs_x__rep_ static svn_error_t * block_read(void **result, svn_fs_t *fs, - const svn_fs_x__id_part_t *id, + const svn_fs_x__id_t *id, svn_fs_x__revision_file_t *revision_file, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; apr_off_t offset, wanted_offset = 0; apr_off_t block_start = 0; apr_uint32_t wanted_sub_item = 0; @@ -3222,8 +3249,7 @@ block_read(void **result, /* the item / container we were looking for? */ is_wanted = entry->offset == wanted_offset && entry->item_count >= wanted_sub_item - && svn_fs_x__id_part_eq(entry->items + wanted_sub_item, - id); + && svn_fs_x__id_eq(entry->items + wanted_sub_item, id); is_result = result && is_wanted; /* select the pool that we want the item to be allocated in */ @@ -3236,7 +3262,7 @@ block_read(void **result, && entry->size < ffd->block_size)) { void *item = NULL; - pair_cache_key_t key = { 0 }; + svn_fs_x__pair_cache_key_t key = { 0 }; key.revision = svn_fs_x__get_revnum(entry->items[0].change_set); key.second = entry->items[0].number; @@ -3258,7 +3284,7 @@ block_read(void **result, case SVN_FS_X__ITEM_TYPE_NODEREV: if (ffd->node_revision_cache || is_result) - SVN_ERR(block_read_noderev((node_revision_t **)&item, + SVN_ERR(block_read_noderev((svn_fs_x__noderev_t **)&item, fs, revision_file, entry, &key, is_result, pool, iterpool)); @@ -3281,7 +3307,7 @@ block_read(void **result, case SVN_FS_X__ITEM_TYPE_NODEREVS_CONT: SVN_ERR(block_read_noderevs_container - ((node_revision_t **)&item, + ((svn_fs_x__noderev_t **)&item, fs, revision_file, entry, wanted_sub_item, is_result, pool, iterpool));
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/cached_data.h URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/cached_data.h?rev=1652409&r1=1652408&r2=1652409&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/cached_data.h (original) +++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/cached_data.h Fri Jan 16 14:01:35 2015 @@ -34,33 +34,33 @@ /* Set *NODEREV_P to the node-revision for the node ID in FS. Do any allocations in POOL. */ svn_error_t * -svn_fs_x__get_node_revision(node_revision_t **noderev_p, +svn_fs_x__get_node_revision(svn_fs_x__noderev_t **noderev_p, svn_fs_t *fs, - const svn_fs_id_t *id, + const svn_fs_x__id_t *id, apr_pool_t *result_pool, apr_pool_t *scratch_pool); /* Set *COUNT to the value of the mergeinfo_count member of the node- - revision for the node ID in FS. Do any allocations in POOL. */ + revision for the node ID in FS. Do temporary allocations in SCRATCH_POOL. + */ svn_error_t * svn_fs_x__get_mergeinfo_count(apr_int64_t *count, svn_fs_t *fs, - const svn_fs_id_t *id, - apr_pool_t *pool); + const svn_fs_x__id_t *id, + apr_pool_t *scratch_pool); -/* Set *ROOT_ID to the node-id for the root of revision REV in - filesystem FS. Do any allocations in POOL. */ +/* Set *ROOT_ID to the noderev ID for the root of revision REV in + filesystem FS. Do temporary allocations in SCRATCH_POOL. */ svn_error_t * -svn_fs_x__rev_get_root(svn_fs_id_t **root_id, +svn_fs_x__rev_get_root(svn_fs_x__id_t *root_id, svn_fs_t *fs, svn_revnum_t rev, - apr_pool_t *result_pool, apr_pool_t *scratch_pool); /* Verify that representation REP in FS can be accessed. Do any allocations in SCRATCH_POOL. */ svn_error_t * -svn_fs_x__check_rep(representation_t *rep, +svn_fs_x__check_rep(svn_fs_x__representation_t *rep, svn_fs_t *fs, apr_pool_t *scratch_pool); @@ -71,7 +71,7 @@ svn_fs_x__check_rep(representation_t *re svn_error_t * svn_fs_x__rep_chain_length(int *chain_length, int *shard_count, - representation_t *rep, + svn_fs_x__representation_t *rep, svn_fs_t *fs, apr_pool_t *scratch_pool); @@ -83,7 +83,7 @@ svn_fs_x__rep_chain_length(int *chain_le svn_error_t * svn_fs_x__get_contents(svn_stream_t **contents_p, svn_fs_t *fs, - representation_t *rep, + svn_fs_x__representation_t *rep, svn_boolean_t cache_fulltext, apr_pool_t *pool); @@ -91,7 +91,7 @@ svn_fs_x__get_contents(svn_stream_t **co * by ENTRY in FS and return the result in PACKED_LEN and EXPANDED_LEN, * respectively. FILE must point to the start of the representation and * STREAM must be a stream defined on top of FILE. - * Use POOL for allocations. + * Use SCRATCH_POOL for temporary allocations. */ svn_error_t * svn_fs_x__get_representation_length(svn_filesize_t *packed_len, @@ -99,31 +99,31 @@ svn_fs_x__get_representation_length(svn_ svn_fs_t *fs, svn_fs_x__revision_file_t *rev_file, svn_fs_x__p2l_entry_t* entry, - apr_pool_t *pool); + apr_pool_t *scratch_pool); /* Attempt to fetch the text representation of node-revision NODEREV as seen in filesystem FS and pass it along with the BATON to the PROCESSOR. Set *SUCCESS only of the data could be provided and the processing had been called. - Use POOL for all allocations. + Use SCRATCH_POOL for temporary allocations. */ svn_error_t * svn_fs_x__try_process_file_contents(svn_boolean_t *success, svn_fs_t *fs, - node_revision_t *noderev, + svn_fs_x__noderev_t *noderev, svn_fs_process_contents_func_t processor, void* baton, - apr_pool_t *pool); + apr_pool_t *scratch_pool); -/* Set *STREAM_P to a delta stream turning the contents of the file SOURCE into - the contents of the file TARGET, allocated in POOL. - If SOURCE is null, the empty string will be used. */ +/* Set *STREAM_P to a delta stream turning the contents of the file SOURCE + into the contents of the file TARGET, allocated in RESULT_POOL. + If SOURCE is NULL, an empty string will be used in its stead. */ svn_error_t * svn_fs_x__get_file_delta_stream(svn_txdelta_stream_t **stream_p, svn_fs_t *fs, - node_revision_t *source, - node_revision_t *target, - apr_pool_t *pool); + svn_fs_x__noderev_t *source, + svn_fs_x__noderev_t *target, + apr_pool_t *result_pool); /* Set *ENTRIES to an apr_array_header_t of dirent structs that contain the directory entries of node-revision NODEREV in filesystem FS. The @@ -132,7 +132,7 @@ svn_fs_x__get_file_delta_stream(svn_txde svn_error_t * svn_fs_x__rep_contents_dir(apr_array_header_t **entries_p, svn_fs_t *fs, - node_revision_t *noderev, + svn_fs_x__noderev_t *noderev, apr_pool_t *result_pool, apr_pool_t *scratch_pool); @@ -140,7 +140,7 @@ svn_fs_x__rep_contents_dir(apr_array_hea entry exists, return NULL. If HINT is not NULL, set *HINT to the array index of the entry returned. Successive calls in a linear scan scenario will be faster called with the same HINT variable. */ -svn_fs_dirent_t * +svn_fs_x__dirent_t * svn_fs_x__find_dir_entry(apr_array_header_t *entries, const char *name, int *hint); @@ -150,9 +150,9 @@ svn_fs_x__find_dir_entry(apr_array_heade be NULL. The returned object is allocated in RESULT_POOL; SCRATCH_POOL used for temporary allocations. */ svn_error_t * -svn_fs_x__rep_contents_dir_entry(svn_fs_dirent_t **dirent, +svn_fs_x__rep_contents_dir_entry(svn_fs_x__dirent_t **dirent, svn_fs_t *fs, - node_revision_t *noderev, + svn_fs_x__noderev_t *noderev, const char *name, apr_pool_t *result_pool, apr_pool_t *scratch_pool); @@ -163,7 +163,7 @@ svn_fs_x__rep_contents_dir_entry(svn_fs_ svn_error_t * svn_fs_x__get_proplist(apr_hash_t **proplist, svn_fs_t *fs, - node_revision_t *noderev, + svn_fs_x__noderev_t *noderev, apr_pool_t *pool); /* Fetch the list of change in revision REV in FS and return it in *CHANGES. Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/caching.c URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/caching.c?rev=1652409&r1=1652408&r2=1652409&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/caching.c (original) +++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/caching.c Fri Jan 16 14:01:35 2015 @@ -43,15 +43,16 @@ #include "private/svn_subr_private.h" /* Take the ORIGINAL string and replace all occurrences of ":" without - * limiting the key space. Allocate the result in POOL. + * limiting the key space. Allocate the result in RESULT_POOL. */ static const char * normalize_key_part(const char *original, - apr_pool_t *pool) + apr_pool_t *result_pool) { apr_size_t i; apr_size_t len = strlen(original); - svn_stringbuf_t *normalized = svn_stringbuf_create_ensure(len, pool); + svn_stringbuf_t *normalized = svn_stringbuf_create_ensure(len, + result_pool); for (i = 0; i < len; ++i) { @@ -73,15 +74,14 @@ normalize_key_part(const char *original, according to FS->CONFIG. *CACHE_NAMESPACE receives the cache prefix to use. - Use FS->pool for allocating the memcache and CACHE_NAMESPACE, and POOL - for temporary allocations. */ + Allocate CACHE_NAMESPACE in RESULT_POOL. */ static svn_error_t * read_config(const char **cache_namespace, svn_boolean_t *cache_txdeltas, svn_boolean_t *cache_fulltexts, svn_boolean_t *cache_revprops, svn_fs_t *fs, - apr_pool_t *pool) + apr_pool_t *result_pool) { /* No cache namespace by default. I.e. all FS instances share the * cached data. If you specify different namespaces, the data will @@ -97,7 +97,7 @@ read_config(const char **cache_namespace = normalize_key_part(svn_hash__get_cstring(fs->config, SVN_FS_CONFIG_FSFS_CACHE_NS, ""), - pool); + result_pool); /* don't cache text deltas by default. * Once we reconstructed the fulltexts from the deltas, @@ -357,12 +357,13 @@ create_cache(svn_cache__t **cache_p, svn_error_t * svn_fs_x__initialize_caches(svn_fs_t *fs, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; - const char *prefix = apr_pstrcat(pool, + svn_fs_x__data_t *ffd = fs->fsap_data; + const char *prefix = apr_pstrcat(scratch_pool, "fsx:", fs->uuid, - "/", normalize_key_part(fs->path, pool), + "/", normalize_key_part(fs->path, + scratch_pool), ":", SVN_VA_NULL); svn_membuffer_t *membuffer; @@ -378,9 +379,10 @@ svn_fs_x__initialize_caches(svn_fs_t *fs &cache_fulltexts, &cache_revprops, fs, - pool)); + scratch_pool)); - prefix = apr_pstrcat(pool, "ns:", cache_namespace, ":", prefix, SVN_VA_NULL); + prefix = apr_pstrcat(scratch_pool, "ns:", cache_namespace, ":", prefix, + SVN_VA_NULL); membuffer = svn_cache__get_global_membuffer_cache(); @@ -405,27 +407,6 @@ svn_fs_x__initialize_caches(svn_fs_t *fs apr_pool_cleanup_null); #endif - /* Make the cache for revision roots. For the vast majority of - * commands, this is only going to contain a few entries (svnadmin - * dump/verify is an exception here), so to reduce overhead let's - * try to keep it to just one page. I estimate each entry has about - * 72 bytes of overhead (svn_revnum_t key, svn_fs_id_t + - * id_private_t + 3 strings for value, and the cache_entry); the - * default pool size is 8192, so about a hundred should fit - * comfortably. */ - SVN_ERR(create_cache(&(ffd->rev_root_id_cache), - NULL, - membuffer, - 1, 100, - svn_fs_x__serialize_id, - svn_fs_x__deserialize_id, - sizeof(svn_revnum_t), - apr_pstrcat(pool, prefix, "RRI", SVN_VA_NULL), - 0, - fs, - no_handler, - fs->pool, pool)); - /* Rough estimate: revision DAG nodes have size around 320 bytes, so * let's put 16 on a page. */ SVN_ERR(create_cache(&(ffd->rev_node_cache), @@ -435,11 +416,11 @@ svn_fs_x__initialize_caches(svn_fs_t *fs svn_fs_x__dag_serialize, svn_fs_x__dag_deserialize, APR_HASH_KEY_STRING, - apr_pstrcat(pool, prefix, "DAG", SVN_VA_NULL), + apr_pstrcat(scratch_pool, prefix, "DAG", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_LOW_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); /* 1st level DAG node cache */ ffd->dag_node_cache = svn_fs_x__create_dag_cache(fs->pool); @@ -451,12 +432,12 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 1024, 8, svn_fs_x__serialize_dir_entries, svn_fs_x__deserialize_dir_entries, - sizeof(svn_fs_x__id_part_t), - apr_pstrcat(pool, prefix, "DIR", SVN_VA_NULL), + sizeof(svn_fs_x__id_t), + apr_pstrcat(scratch_pool, prefix, "DIR", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); /* Only 16 bytes per entry (a revision number + the corresponding offset). Since we want ~8k pages, that means 512 entries per page. */ @@ -467,12 +448,12 @@ svn_fs_x__initialize_caches(svn_fs_t *fs svn_fs_x__serialize_manifest, svn_fs_x__deserialize_manifest, sizeof(svn_revnum_t), - apr_pstrcat(pool, prefix, "PACK-MANIFEST", + apr_pstrcat(scratch_pool, prefix, "PACK-MANIFEST", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); /* initialize node revision cache, if caching has been enabled */ SVN_ERR(create_cache(&(ffd->node_revision_cache), @@ -481,12 +462,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 32, 32, /* ~200 byte / entry; 1k entries total */ svn_fs_x__serialize_node_revision, svn_fs_x__deserialize_node_revision, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "NODEREVS", SVN_VA_NULL), + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "NODEREVS", + SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); /* initialize representation header cache, if caching has been enabled */ SVN_ERR(create_cache(&(ffd->rep_header_cache), @@ -495,12 +477,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 1, 1000, /* ~8 bytes / entry; 1k entries total */ svn_fs_x__serialize_rep_header, svn_fs_x__deserialize_rep_header, - sizeof(representation_cache_key_t), - apr_pstrcat(pool, prefix, "REPHEADER", SVN_VA_NULL), + sizeof(svn_fs_x__representation_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "REPHEADER", + SVN_VA_NULL), SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); /* initialize node change list cache, if caching has been enabled */ SVN_ERR(create_cache(&(ffd->changes_cache), @@ -510,11 +493,12 @@ svn_fs_x__initialize_caches(svn_fs_t *fs svn_fs_x__serialize_changes, svn_fs_x__deserialize_changes, sizeof(svn_revnum_t), - apr_pstrcat(pool, prefix, "CHANGES", SVN_VA_NULL), + apr_pstrcat(scratch_pool, prefix, "CHANGES", + SVN_VA_NULL), 0, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); /* if enabled, cache fulltext and other derived information */ if (cache_fulltexts) @@ -525,12 +509,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 0, 0, /* Do not use inprocess cache */ /* Values are svn_stringbuf_t */ NULL, NULL, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "TEXT", SVN_VA_NULL), + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "TEXT", + SVN_VA_NULL), SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->properties_cache), NULL, @@ -538,13 +523,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 0, 0, /* Do not use inprocess cache */ svn_fs_x__serialize_properties, svn_fs_x__deserialize_properties, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "PROP", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "PROP", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->mergeinfo_cache), NULL, @@ -553,12 +538,12 @@ svn_fs_x__initialize_caches(svn_fs_t *fs svn_fs_x__serialize_mergeinfo, svn_fs_x__deserialize_mergeinfo, APR_HASH_KEY_STRING, - apr_pstrcat(pool, prefix, "MERGEINFO", + apr_pstrcat(scratch_pool, prefix, "MERGEINFO", SVN_VA_NULL), 0, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->mergeinfo_existence_cache), NULL, @@ -567,12 +552,12 @@ svn_fs_x__initialize_caches(svn_fs_t *fs /* Values are svn_stringbuf_t */ NULL, NULL, APR_HASH_KEY_STRING, - apr_pstrcat(pool, prefix, "HAS_MERGEINFO", + apr_pstrcat(scratch_pool, prefix, "HAS_MERGEINFO", SVN_VA_NULL), 0, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); } else { @@ -591,13 +576,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 0, 0, /* Do not use inprocess cache */ svn_fs_x__serialize_properties, svn_fs_x__deserialize_properties, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "REVPROP", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "REVPROP", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); } else { @@ -613,13 +598,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 0, 0, /* Do not use inprocess cache */ svn_fs_x__serialize_txdelta_window, svn_fs_x__deserialize_txdelta_window, - sizeof(window_cache_key_t), - apr_pstrcat(pool, prefix, "TXDELTA_WINDOW", + sizeof(svn_fs_x__window_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "TXDELTA_WINDOW", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_LOW_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->combined_window_cache), NULL, @@ -627,13 +612,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 0, 0, /* Do not use inprocess cache */ /* Values are svn_stringbuf_t */ NULL, NULL, - sizeof(window_cache_key_t), - apr_pstrcat(pool, prefix, "COMBINED_WINDOW", + sizeof(svn_fs_x__window_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "COMBINED_WINDOW", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_LOW_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); } else { @@ -647,39 +632,39 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 16, 4, /* Important, largish objects */ svn_fs_x__serialize_noderevs_container, svn_fs_x__deserialize_noderevs_container, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "NODEREVSCNT", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "NODEREVSCNT", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->changes_container_cache), NULL, membuffer, 0, 0, /* Do not use inprocess cache */ svn_fs_x__serialize_changes_container, svn_fs_x__deserialize_changes_container, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "CHANGESCNT", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "CHANGESCNT", SVN_VA_NULL), 0, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->reps_container_cache), NULL, membuffer, 0, 0, /* Do not use inprocess cache */ svn_fs_x__serialize_reps_container, svn_fs_x__deserialize_reps_container, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "REPSCNT", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "REPSCNT", SVN_VA_NULL), 0, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->l2p_header_cache), NULL, @@ -688,13 +673,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs a reasonable number of revisions (1k) */ svn_fs_x__serialize_l2p_header, svn_fs_x__deserialize_l2p_header, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "L2P_HEADER", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "L2P_HEADER", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->l2p_page_cache), NULL, membuffer, @@ -703,25 +688,25 @@ svn_fs_x__initialize_caches(svn_fs_t *fs svn_fs_x__serialize_l2p_page, svn_fs_x__deserialize_l2p_page, sizeof(svn_fs_x__page_cache_key_t), - apr_pstrcat(pool, prefix, "L2P_PAGE", + apr_pstrcat(scratch_pool, prefix, "L2P_PAGE", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->p2l_header_cache), NULL, membuffer, 4, 1, /* Large entries. Rarely used. */ svn_fs_x__serialize_p2l_header, svn_fs_x__deserialize_p2l_header, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "P2L_HEADER", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "P2L_HEADER", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->p2l_page_cache), NULL, membuffer, @@ -729,12 +714,12 @@ svn_fs_x__initialize_caches(svn_fs_t *fs svn_fs_x__serialize_p2l_page, svn_fs_x__deserialize_p2l_page, sizeof(svn_fs_x__page_cache_key_t), - apr_pstrcat(pool, prefix, "P2L_PAGE", + apr_pstrcat(scratch_pool, prefix, "P2L_PAGE", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); return SVN_NO_ERROR; }
