Modified: subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/caching.c URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/caching.c?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/caching.c (original) +++ subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/caching.c Thu Sep 26 13:47:21 2013 @@ -116,7 +116,8 @@ read_config(svn_memcache_t **memcache_p, *cache_txdeltas = svn_hash__get_bool(fs->config, SVN_FS_CONFIG_FSFS_CACHE_DELTAS, - FALSE); + TRUE); + /* by default, cache fulltexts. * Most SVN tools care about reconstructed file content. * Thus, this is a reasonable default. @@ -397,6 +398,15 @@ svn_fs_fs__initialize_caches(svn_fs_t *f membuffer = svn_cache__get_global_membuffer_cache(); + /* General rules for assigning cache priorities: + * + * - Data that can be reconstructed from other elements has low prio + * (e.g. fulltexts, directories etc.) + * - Index data required to find any of the other data has high prio + * (e.g. noderevs) + * - everthing else should use default prio + */ + #ifdef SVN_DEBUG_CACHE_DUMP_STATS /* schedule printing the global access statistics upon pool cleanup, @@ -440,7 +450,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f svn_fs_fs__dag_deserialize, APR_HASH_KEY_STRING, apr_pstrcat(pool, prefix, "DAG", (char *)NULL), - 0, + SVN_CACHE__MEMBUFFER_LOW_PRIORITY, fs, no_handler, fs->pool)); @@ -455,9 +465,9 @@ svn_fs_fs__initialize_caches(svn_fs_t *f 1024, 8, svn_fs_fs__serialize_dir_entries, svn_fs_fs__deserialize_dir_entries, - APR_HASH_KEY_STRING, + sizeof(pair_cache_key_t), apr_pstrcat(pool, prefix, "DIR", (char *)NULL), - 0, + SVN_CACHE__MEMBUFFER_LOW_PRIORITY, fs, no_handler, fs->pool)); @@ -473,7 +483,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f sizeof(svn_revnum_t), apr_pstrcat(pool, prefix, "PACK-MANIFEST", (char *)NULL), - 0, + SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, fs->pool)); @@ -487,7 +497,21 @@ svn_fs_fs__initialize_caches(svn_fs_t *f svn_fs_fs__deserialize_node_revision, sizeof(pair_cache_key_t), apr_pstrcat(pool, prefix, "NODEREVS", (char *)NULL), - 0, + SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, + fs, + no_handler, + fs->pool)); + + /* initialize representation header cache, if caching has been enabled */ + SVN_ERR(create_cache(&(ffd->rep_header_cache), + NULL, + membuffer, + 0, 0, /* Do not use inprocess cache */ + svn_fs_fs__serialize_rep_header, + svn_fs_fs__deserialize_rep_header, + sizeof(representation_cache_key_t), + apr_pstrcat(pool, prefix, "REPHEADER", (char *)NULL), + SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, fs->pool)); @@ -531,7 +555,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f sizeof(pair_cache_key_t), apr_pstrcat(pool, prefix, "PROP", (char *)NULL), - 0, + SVN_CACHE__MEMBUFFER_LOW_PRIORITY, fs, no_handler, fs->pool)); @@ -584,7 +608,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f sizeof(pair_cache_key_t), apr_pstrcat(pool, prefix, "REVPROP", (char *)NULL), - 0, + SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, fs->pool)); @@ -603,7 +627,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f 0, 0, /* Do not use inprocess cache */ svn_fs_fs__serialize_txdelta_window, svn_fs_fs__deserialize_txdelta_window, - APR_HASH_KEY_STRING, + sizeof(window_cache_key_t), apr_pstrcat(pool, prefix, "TXDELTA_WINDOW", (char *)NULL), 0, @@ -617,7 +641,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f 0, 0, /* Do not use inprocess cache */ /* Values are svn_stringbuf_t */ NULL, NULL, - APR_HASH_KEY_STRING, + sizeof(window_cache_key_t), apr_pstrcat(pool, prefix, "COMBINED_WINDOW", (char *)NULL), SVN_CACHE__MEMBUFFER_LOW_PRIORITY,
Modified: subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/dag.c URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/dag.c?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/dag.c (original) +++ subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/dag.c Thu Sep 26 13:47:21 2013 @@ -28,11 +28,12 @@ #include "svn_props.h" #include "svn_pools.h" +#include "cached_data.h" #include "dag.h" #include "fs.h" -#include "key-gen.h" #include "fs_fs.h" #include "id.h" +#include "transaction.h" #include "../libsvn_fs/fs-loader.h" @@ -173,7 +174,7 @@ get_node_revision(node_revision_t **node svn_boolean_t svn_fs_fs__dag_check_mutable(const dag_node_t *node) { - return (svn_fs_fs__id_txn_id(svn_fs_fs__dag_get_id(node)) != NULL); + return svn_fs_fs__id_is_txn(svn_fs_fs__dag_get_id(node)); } @@ -312,8 +313,9 @@ dir_entry_id_from_node(const svn_fs_id_t { svn_fs_dirent_t *dirent; - SVN_ERR(svn_fs_fs__dag_dir_entry(&dirent, parent, name, scratch_pool)); - *id_p = dirent ? svn_fs_fs__id_copy(dirent->id, result_pool) : NULL; + SVN_ERR(svn_fs_fs__dag_dir_entry(&dirent, parent, name, result_pool, + scratch_pool)); + *id_p = dirent ? dirent->id : NULL; return SVN_NO_ERROR; } @@ -332,7 +334,7 @@ set_entry(dag_node_t *parent, const char *name, const svn_fs_id_t *id, svn_node_kind_t kind, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool) { node_revision_t *parent_noderev; @@ -359,7 +361,7 @@ make_entry(dag_node_t **child_p, const char *parent_path, const char *name, svn_boolean_t is_dir, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool) { const svn_fs_id_t *new_node_id; @@ -432,7 +434,8 @@ svn_error_t * svn_fs_fs__dag_dir_entry(svn_fs_dirent_t **dirent, dag_node_t *node, const char* name, - apr_pool_t *pool) + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) { node_revision_t *noderev; SVN_ERR(get_node_revision(&noderev, node)); @@ -442,8 +445,8 @@ svn_fs_fs__dag_dir_entry(svn_fs_dirent_t _("Can't get entries of non-directory")); /* Get a dirent hash for this directory. */ - return svn_fs_fs__rep_contents_dir_entry(dirent, node->fs, - noderev, name, pool, pool); + return svn_fs_fs__rep_contents_dir_entry(dirent, node->fs, noderev, name, + result_pool, scratch_pool); } @@ -452,7 +455,7 @@ svn_fs_fs__dag_set_entry(dag_node_t *nod const char *entry_name, const svn_fs_id_t *id, svn_node_kind_t kind, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool) { /* Check it's a directory. */ @@ -606,17 +609,31 @@ svn_fs_fs__dag_revision_root(dag_node_t svn_revnum_t rev, apr_pool_t *pool) { - svn_fs_id_t *root_id; + dag_node_t *new_node; - SVN_ERR(svn_fs_fs__rev_get_root(&root_id, fs, rev, pool)); - return svn_fs_fs__dag_get_node(node_p, fs, root_id, pool); + /* Construct the node. */ + new_node = apr_pcalloc(pool, sizeof(*new_node)); + new_node->fs = fs; + SVN_ERR(svn_fs_fs__rev_get_root(&new_node->id, fs, rev, pool)); + + /* Grab the contents so we can inspect the node's kind and created path. */ + new_node->node_pool = pool; + + /* Initialize the KIND and CREATED_PATH attributes */ + new_node->kind = svn_node_dir; + new_node->created_path = "/"; + new_node->fresh_root_predecessor_id = NULL; + + /* Return a fresh new node */ + *node_p = new_node; + return SVN_NO_ERROR; } svn_error_t * svn_fs_fs__dag_txn_root(dag_node_t **node_p, svn_fs_t *fs, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool) { const svn_fs_id_t *root_id, *ignored; @@ -629,7 +646,7 @@ svn_fs_fs__dag_txn_root(dag_node_t **nod svn_error_t * svn_fs_fs__dag_txn_base_root(dag_node_t **node_p, svn_fs_t *fs, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool) { const svn_fs_id_t *base_root_id, *ignored; @@ -644,8 +661,8 @@ svn_fs_fs__dag_clone_child(dag_node_t ** dag_node_t *parent, const char *parent_path, const char *name, - const char *copy_id, - const char *txn_id, + const svn_fs_fs__id_part_t *copy_id, + const svn_fs_fs__id_part_t *txn_id, svn_boolean_t is_parent_copyroot, apr_pool_t *pool) { @@ -718,7 +735,7 @@ svn_fs_fs__dag_clone_child(dag_node_t ** svn_error_t * svn_fs_fs__dag_clone_root(dag_node_t **root_p, svn_fs_t *fs, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool) { const svn_fs_id_t *base_root_id, *root_id; @@ -745,7 +762,7 @@ svn_fs_fs__dag_clone_root(dag_node_t **r svn_error_t * svn_fs_fs__dag_delete(dag_node_t *parent, const char *name, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool) { node_revision_t *parent_noderev; @@ -869,7 +886,7 @@ svn_fs_fs__dag_make_file(dag_node_t **ch dag_node_t *parent, const char *parent_path, const char *name, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool) { /* Call our little helper function */ @@ -882,7 +899,7 @@ svn_fs_fs__dag_make_dir(dag_node_t **chi dag_node_t *parent, const char *parent_path, const char *name, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool) { /* Call our little helper function */ @@ -909,7 +926,7 @@ svn_fs_fs__dag_get_contents(svn_stream_t /* Get a stream to the contents. */ SVN_ERR(svn_fs_fs__get_contents(&contents, file->fs, - noderev, pool)); + noderev->data_rep, pool)); *contents_p = contents; @@ -1187,7 +1204,7 @@ svn_fs_fs__dag_copy(dag_node_t *to_node, svn_boolean_t preserve_history, svn_revnum_t from_rev, const char *from_path, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool) { const svn_fs_id_t *id; @@ -1195,7 +1212,7 @@ svn_fs_fs__dag_copy(dag_node_t *to_node, if (preserve_history) { node_revision_t *from_noderev, *to_noderev; - const char *copy_id; + svn_fs_fs__id_part_t copy_id; const svn_fs_id_t *src_id = svn_fs_fs__dag_get_id(from_node); svn_fs_t *fs = svn_fs_fs__dag_get_fs(from_node); @@ -1221,7 +1238,7 @@ svn_fs_fs__dag_copy(dag_node_t *to_node, to_noderev->copyroot_path = NULL; SVN_ERR(svn_fs_fs__create_successor(&id, fs, src_id, to_noderev, - copy_id, txn_id, pool)); + ©_id, txn_id, pool)); } else /* don't preserve history */ Modified: subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/dag.h URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/dag.h?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/dag.h (original) +++ subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/dag.h Thu Sep 26 13:47:21 2013 @@ -27,6 +27,8 @@ #include "svn_delta.h" #include "private/svn_cache.h" +#include "id.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -224,7 +226,7 @@ svn_error_t *svn_fs_fs__dag_revision_roo for a transaction, call svn_fs_fs__dag_clone_root. */ svn_error_t *svn_fs_fs__dag_txn_root(dag_node_t **node_p, svn_fs_t *fs, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool); @@ -232,7 +234,7 @@ svn_error_t *svn_fs_fs__dag_txn_root(dag allocating from POOL. Allocate the node in TRAIL->pool. */ svn_error_t *svn_fs_fs__dag_txn_base_root(dag_node_t **node_p, svn_fs_t *fs, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool); @@ -242,7 +244,7 @@ svn_error_t *svn_fs_fs__dag_txn_base_roo root directory clone. Allocate *ROOT_P in POOL. */ svn_error_t *svn_fs_fs__dag_clone_root(dag_node_t **root_p, svn_fs_t *fs, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool); @@ -272,14 +274,16 @@ svn_error_t *svn_fs_fs__dag_dir_entries( /* Fetches the NODE's entries and returns a copy of the entry selected by the key value given in NAME and set *DIRENT to a copy of that - entry. If such entry was found, the copy will be allocated in POOL. + entry. If such entry was found, the copy will be allocated in + RESULT_POOL. Temporary data will be used in SCRATCH_POOL. Otherwise, the *DIRENT will be set to NULL. */ /* ### This function is currently only called from dag.c. */ svn_error_t * svn_fs_fs__dag_dir_entry(svn_fs_dirent_t **dirent, dag_node_t *node, const char* name, - apr_pool_t *pool); + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); /* Set ENTRY_NAME in NODE to point to ID (with kind KIND), allocating from POOL. NODE must be a mutable directory. ID can refer to a @@ -294,7 +298,7 @@ svn_error_t *svn_fs_fs__dag_set_entry(da const char *entry_name, const svn_fs_id_t *id, svn_node_kind_t kind, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool); @@ -321,8 +325,8 @@ svn_error_t *svn_fs_fs__dag_clone_child( dag_node_t *parent, const char *parent_path, const char *name, - const char *copy_id, - const char *txn_id, + const svn_fs_fs__id_part_t *copy_id, + const svn_fs_fs__id_part_t *txn_id, svn_boolean_t is_parent_copyroot, apr_pool_t *pool); @@ -341,7 +345,7 @@ svn_error_t *svn_fs_fs__dag_clone_child( */ svn_error_t *svn_fs_fs__dag_delete(dag_node_t *parent, const char *name, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool); @@ -384,7 +388,7 @@ svn_error_t *svn_fs_fs__dag_make_dir(dag dag_node_t *parent, const char *parent_path, const char *name, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool); @@ -495,7 +499,7 @@ svn_error_t *svn_fs_fs__dag_make_file(da dag_node_t *parent, const char *parent_path, const char *name, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool); @@ -522,7 +526,7 @@ svn_error_t *svn_fs_fs__dag_copy(dag_nod svn_boolean_t preserve_history, svn_revnum_t from_rev, const char *from_path, - const char *txn_id, + const svn_fs_fs__id_part_t *txn_id, apr_pool_t *pool); Modified: subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/fs.c URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/fs.c?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/fs.c (original) +++ subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/fs.c Thu Sep 26 13:47:21 2013 @@ -37,8 +37,14 @@ #include "fs_fs.h" #include "tree.h" #include "lock.h" +#include "hotcopy.h" #include "id.h" +#include "pack.h" +#include "recovery.h" #include "rep-cache.h" +#include "revprops.h" +#include "transaction.h" +#include "verify.h" #include "svn_private_config.h" #include "private/svn_fs_util.h" @@ -185,7 +191,7 @@ fs_info(const void **fsfs_info, static fs_vtable_t fs_vtable = { svn_fs_fs__youngest_rev, svn_fs_fs__revision_prop, - svn_fs_fs__revision_proplist, + svn_fs_fs__get_revision_proplist, svn_fs_fs__change_rev_prop, svn_fs_fs__set_uuid, svn_fs_fs__revision_root, @@ -223,9 +229,12 @@ initialize_fs_struct(svn_fs_t *fs) /* This implements the fs_library_vtable_t.create() API. Create a new fsfs-backed Subversion filesystem at path PATH and link it into *FS. Perform temporary allocations in POOL, and fs-global allocations - in COMMON_POOL. */ + in COMMON_POOL. The latter must be serialized using COMMON_POOL_LOCK. */ static svn_error_t * -fs_create(svn_fs_t *fs, const char *path, apr_pool_t *pool, +fs_create(svn_fs_t *fs, + const char *path, + svn_mutex__t *common_pool_lock, + apr_pool_t *pool, apr_pool_t *common_pool) { SVN_ERR(svn_fs__check_fs(fs, FALSE)); @@ -235,7 +244,10 @@ fs_create(svn_fs_t *fs, const char *path SVN_ERR(svn_fs_fs__create(fs, path, pool)); SVN_ERR(svn_fs_fs__initialize_caches(fs, pool)); - return fs_serialized_init(fs, common_pool, pool); + SVN_MUTEX__WITH_LOCK(common_pool_lock, + fs_serialized_init(fs, common_pool, pool)); + + return SVN_NO_ERROR; } @@ -245,17 +257,26 @@ fs_create(svn_fs_t *fs, const char *path /* This implements the fs_library_vtable_t.open() API. Open an FSFS Subversion filesystem located at PATH, set *FS to point to the correct vtable for the filesystem. Use POOL for any temporary - allocations, and COMMON_POOL for fs-global allocations. */ + allocations, and COMMON_POOL for fs-global allocations. + The latter must be serialized using COMMON_POOL_LOCK. */ static svn_error_t * -fs_open(svn_fs_t *fs, const char *path, apr_pool_t *pool, +fs_open(svn_fs_t *fs, + const char *path, + svn_mutex__t *common_pool_lock, + apr_pool_t *pool, apr_pool_t *common_pool) { + SVN_ERR(svn_fs__check_fs(fs, FALSE)); + SVN_ERR(initialize_fs_struct(fs)); SVN_ERR(svn_fs_fs__open(fs, path, pool)); SVN_ERR(svn_fs_fs__initialize_caches(fs, pool)); - return fs_serialized_init(fs, common_pool, pool); + SVN_MUTEX__WITH_LOCK(common_pool_lock, + fs_serialized_init(fs, common_pool, pool)); + + return SVN_NO_ERROR; } @@ -264,7 +285,9 @@ fs_open(svn_fs_t *fs, const char *path, static svn_error_t * fs_open_for_recovery(svn_fs_t *fs, const char *path, - apr_pool_t *pool, apr_pool_t *common_pool) + svn_mutex__t *common_pool_lock, + apr_pool_t *pool, + apr_pool_t *common_pool) { /* Recovery for FSFS is currently limited to recreating the 'current' file from the latest revision. */ @@ -282,7 +305,7 @@ fs_open_for_recovery(svn_fs_t *fs, "0 1 1\n", pool)); /* Now open the filesystem properly by calling the vtable method directly. */ - return fs_open(fs, path, pool, common_pool); + return fs_open(fs, path, common_pool_lock, pool, common_pool); } @@ -295,14 +318,11 @@ fs_upgrade(svn_fs_t *fs, void *notify_baton, svn_cancel_func_t cancel_func, void *cancel_baton, + svn_mutex__t *common_pool_lock, apr_pool_t *pool, apr_pool_t *common_pool) { - SVN_ERR(svn_fs__check_fs(fs, FALSE)); - SVN_ERR(initialize_fs_struct(fs)); - SVN_ERR(svn_fs_fs__open(fs, path, pool)); - SVN_ERR(svn_fs_fs__initialize_caches(fs, pool)); - SVN_ERR(fs_serialized_init(fs, common_pool, pool)); + SVN_ERR(fs_open(fs, path, common_pool_lock, pool, common_pool)); return svn_fs_fs__upgrade(fs, notify_func, notify_baton, cancel_func, cancel_baton, pool); } @@ -315,14 +335,11 @@ fs_verify(svn_fs_t *fs, const char *path void *notify_baton, svn_cancel_func_t cancel_func, void *cancel_baton, + svn_mutex__t *common_pool_lock, apr_pool_t *pool, apr_pool_t *common_pool) { - SVN_ERR(svn_fs__check_fs(fs, FALSE)); - SVN_ERR(initialize_fs_struct(fs)); - SVN_ERR(svn_fs_fs__open(fs, path, pool)); - SVN_ERR(svn_fs_fs__initialize_caches(fs, pool)); - SVN_ERR(fs_serialized_init(fs, common_pool, pool)); + SVN_ERR(fs_open(fs, path, common_pool_lock, pool, common_pool)); return svn_fs_fs__verify(fs, start, end, notify_func, notify_baton, cancel_func, cancel_baton, pool); } @@ -334,14 +351,11 @@ fs_pack(svn_fs_t *fs, void *notify_baton, svn_cancel_func_t cancel_func, void *cancel_baton, + svn_mutex__t *common_pool_lock, apr_pool_t *pool, apr_pool_t *common_pool) { - SVN_ERR(svn_fs__check_fs(fs, FALSE)); - SVN_ERR(initialize_fs_struct(fs)); - SVN_ERR(svn_fs_fs__open(fs, path, pool)); - SVN_ERR(svn_fs_fs__initialize_caches(fs, pool)); - SVN_ERR(fs_serialized_init(fs, common_pool, pool)); + SVN_ERR(fs_open(fs, path, common_pool_lock, pool, common_pool)); return svn_fs_fs__pack(fs, notify_func, notify_baton, cancel_func, cancel_baton, pool); } Modified: subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/fs.h URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/fs.h?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/fs.h (original) +++ subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_fs_fs/fs.h Thu Sep 26 13:47:21 2013 @@ -26,6 +26,8 @@ #include <apr_pools.h> #include <apr_hash.h> #include <apr_network_io.h> +#include <apr_md5.h> +#include <apr_sha1.h> #include "svn_fs.h" #include "svn_config.h" @@ -36,6 +38,8 @@ #include "private/svn_mutex.h" #include "private/svn_named_atomic.h" +#include "id.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -144,6 +148,9 @@ extern "C" { /* The minimum format number that supports packed revprops. */ #define SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT 6 +/* Minimum format number that will record moves */ +#define SVN_FS_FS__MIN_MOVE_SUPPORT_FORMAT 7 + /* The minimum format number that supports a configuration file (fsfs.conf) */ #define SVN_FS_FS__MIN_CONFIG_FILE 4 @@ -157,13 +164,8 @@ typedef struct fs_fs_shared_txn_data_t transaction. */ struct fs_fs_shared_txn_data_t *next; - /* This transaction's ID. For repositories whose format is less - than SVN_FS_FS__MIN_TXN_CURRENT_FORMAT, the ID is in the form - <rev>-<uniqueifier>, where <uniqueifier> runs from 0-99999 (see - create_txn_dir_pre_1_5() in fs_fs.c). For newer repositories, - the form is <rev>-<200 digit base 36 number> (see - create_txn_dir() in fs_fs.c). */ - char txn_id[SVN_FS__TXN_MAX_LEN+1]; + /* ID of this transaction. */ + svn_fs_fs__id_part_t txn_id; /* Whether the transaction's prototype revision file is locked for writing by any thread in this process (including the current @@ -224,7 +226,7 @@ typedef struct fs_fs_dag_cache_t fs_fs_d /* Key type for all caches that use revision + offset / counter as key. NOTE: always initialize this using calloc() or '= {0};'! This is used - as a cahe key and the padding bytes on 32 bit archs should be zero for + as a cache key and the padding bytes on 32 bit archs should be zero for cache effectiveness. */ typedef struct pair_cache_key_t { @@ -233,6 +235,32 @@ typedef struct pair_cache_key_t apr_int64_t second; } pair_cache_key_t; +/* Key type that identifies a representation / rep header. */ +typedef struct representation_cache_key_t +{ + /* Revision that contains the representation */ + apr_uint32_t revision; + + /* Packed or non-packed representation? */ + svn_boolean_t is_packed; + + /* Item offset of the representation */ + apr_uint64_t offset; +} representation_cache_key_t; + +/* Key type that identifies a txdelta window. */ +typedef struct window_cache_key_t +{ + /* Revision that contains the representation */ + apr_uint32_t revision; + + /* Window number within that representation */ + apr_int32_t chunk_index; + + /* Offset of the representation within REVISION */ + apr_uint64_t offset; +} window_cache_key_t; + /* Private (non-shared) FSFS-specific data for each svn_fs_t object. Any caches in here may be NULL. */ typedef struct fs_fs_data_t @@ -297,11 +325,11 @@ typedef struct fs_fs_data_t respective pack file. */ svn_cache__t *packed_offset_cache; - /* Cache for txdelta_window_t objects; the key is (revFilePath, offset) */ + /* Cache for txdelta_window_t objects; the key is window_cache_key_t */ svn_cache__t *txdelta_window_cache; /* Cache for combined windows as svn_stringbuf_t objects; - the key is (revFilePath, offset) */ + the key is window_cache_key_t */ svn_cache__t *combined_window_cache; /* Cache for node_revision_t objects; the key is (revision, id offset) */ @@ -311,6 +339,10 @@ typedef struct fs_fs_data_t is the revision */ svn_cache__t *changes_cache; + /* Cache for svn_fs_fs__rep_header_t objects; the key is a + (revision, is_packed, offset) set */ + svn_cache__t *rep_header_cache; + /* Cache for svn_mergeinfo_t objects; the key is a combination of revision, inheritance flags and path. */ svn_cache__t *mergeinfo_cache; @@ -399,26 +431,26 @@ typedef struct transaction_t * svn_fs_fs__rep_copy. */ typedef struct representation_t { - /* Checksums for the contents produced by this representation. + /* Checksums digests for the contents produced by this representation. This checksum is for the contents the rep shows to consumers, regardless of how the rep stores the data under the hood. It is independent of the storage (fulltext, delta, whatever). - If checksum is NULL, then for compatibility behave as though this + If has_sha1 is FALSE, then for compatibility behave as though this checksum matches the expected checksum. The md5 checksum is always filled, unless this is rep which was retrieved from the rep-cache. The sha1 checksum is only computed on - a write, for use with rep-sharing; it may be read from an existing - representation, but otherwise it is NULL. */ - svn_checksum_t *md5_checksum; - svn_checksum_t *sha1_checksum; + a write, for use with rep-sharing. */ + svn_boolean_t has_sha1; + unsigned char sha1_digest[APR_SHA1_DIGESTSIZE]; + unsigned char md5_digest[APR_MD5_DIGESTSIZE]; /* Revision where this representation is located. */ svn_revnum_t revision; /* Offset into the revision file where it is located. */ - apr_off_t offset; + svn_filesize_t offset; /* The size of the representation in bytes as seen in the revision file. */ @@ -428,17 +460,21 @@ typedef struct representation_t * the fulltext size is equal to representation size in the rev file, */ svn_filesize_t expanded_size; - /* Is this representation a transaction? */ - const char *txn_id; + /* Is this a representation (still) within a transaction? */ + svn_fs_fs__id_part_t txn_id; /* For rep-sharing, we need a way of uniquifying node-revs which share the same representation (see svn_fs_fs__noderev_same_rep_key() ). So, we store the original txn of the node rev (not the rep!), along with some - intra-node uniqification content. - - May be NULL, in which case, it is considered to match other NULL - values.*/ - const char *uniquifier; + intra-node uniqification content. */ + struct + { + /* unique context, i.e. txn ID, in which the noderev (!) got created */ + svn_fs_fs__id_part_t noderev_txn_id; + + /* unique value within that txn */ + apr_uint64_t number; + } uniquifier; } representation_t; @@ -498,25 +534,10 @@ typedef struct node_revision_t typedef struct change_t { /* Path of the change. */ - const char *path; - - /* Node revision ID of the change. */ - const svn_fs_id_t *noderev_id; - - /* The kind of change. */ - svn_fs_path_change_kind_t kind; - - /* Text or property mods? */ - svn_boolean_t text_mod; - svn_boolean_t prop_mod; - - /* Node kind (possibly svn_node_unknown). */ - svn_node_kind_t node_kind; - - /* Copyfrom revision and path. */ - svn_revnum_t copyfrom_rev; - const char * copyfrom_path; + svn_string_t path; + /* API compatible change description */ + svn_fs_path_change2_t info; } change_t;
