Author: stefan2
Date: Sat Feb 21 16:38:34 2015
New Revision: 1661391
URL: http://svn.apache.org/r1661391
Log:
On the fsx-1.10 branch:
* subversion/libsvn_fs_x/dag_cache.c
(dag_node_cache_get): Remove separate function and implement the
replacement as part of ...
(try_match_last_node): ... this one, its sole caller. Handle the
cache cleanup.
Modified:
subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c
Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c
URL:
http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c?rev=1661391&r1=1661390&r2=1661391&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c Sat Feb 21
16:38:34 2015
@@ -424,25 +424,6 @@ dag_node_cache_get(svn_fs_root_t *root,
}
-/* Add the NODE for PATH to ROOT's node cache. Call this function only
- if NODE is not known to be a txn node. svn_fs_x__update_dag_cache()
- should be called if NODE is known to be a txn node. */
-static void
-set_dag_node(svn_fs_root_t *root,
- const char *path,
- dag_node_t *node)
-{
- svn_fs_x__data_t *ffd = root->fs->fsap_data;
- cache_entry_t *bucket;
- svn_fs_x__dag_cache_t *cache = ffd->dag_node_cache;
- svn_string_t normalized;
-
- auto_clear_dag_cache(cache);
- bucket = cache_lookup(cache, svn_fs_x__root_change_set(root),
- normalize_path(&normalized, path));
- bucket->node = svn_fs_x__dag_copy_into_pool(node, cache->pool);
-}
-
void
svn_fs_x__update_dag_cache(dag_node_t *node)
{
@@ -524,11 +505,22 @@ try_match_last_node(dag_node_t **node_p,
&& strlen(created_path) == path->len
&& memcmp(created_path, path->data, path->len) == 0)
{
- /* Cache it under its full path@rev access path. */
- set_dag_node(root, created_path, node);
+ svn_fs_x__dag_cache_t *cache = ffd->dag_node_cache;
- *node_p = node;
- return SVN_NO_ERROR;
+ /* Insert NODE into the cache at a second location.
+ In a fraction of all calls, the auto-cleanup may
+ cause NODE to become invalid. */
+ if (!auto_clear_dag_cache(cache))
+ {
+ /* Cache it under its full path@rev access path. */
+ svn_fs_x__change_set_t change_set
+ = svn_fs_x__change_set_by_rev(revision);
+ cache_entry_t *bucket = cache_lookup(cache, change_set, path);
+ bucket->node = node;
+
+ *node_p = node;
+ return SVN_NO_ERROR;
+ }
}
}