Author: stefan2
Date: Thu Feb 19 21:03:11 2015
New Revision: 1661004
URL: http://svn.apache.org/r1661004
Log:
On the fsx-1.10 branch: Simplify FSX' DAG cache update function call.
The new interface function has a much simpler interface.
* subversion/libsvn_fs_x/dag_cache.h
(svn_fs_x__set_dag_node): Replace by ...
(svn_fs_x__update_dag_cache): ... this new function.
* subversion/libsvn_fs_x/dag_cache.c
(svn_fs_x__set_dag_node): Demote to static and rename to ...
(set_dag_node): ... this. Use this function only when we also need
to handle committed nodes.
(svn_fs_x__update_dag_cache): Implement similar to set_dag_node but
extract all parameters from NODE.
(try_match_last_node,
svn_fs_x__get_dag_path): Update callers.
(svn_fs_x__make_path_mutable): Call new, txn-specific function.
* subversion/libsvn_fs_x/tree.c
(x_make_dir,
x_make_file): Update callers.
Modified:
subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c
subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.h
subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.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=1661004&r1=1661003&r2=1661004&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 Thu Feb 19
21:03:11 2015
@@ -434,11 +434,13 @@ dag_node_cache_get(svn_fs_root_t *root,
}
-/* Add the NODE for PATH to ROOT's node cache. */
-void
-svn_fs_x__set_dag_node(svn_fs_root_t *root,
- const char *path,
- dag_node_t *node)
+/* 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;
@@ -452,6 +454,22 @@ svn_fs_x__set_dag_node(svn_fs_root_t *ro
}
void
+svn_fs_x__update_dag_cache(dag_node_t *node)
+{
+ svn_fs_x__data_t *ffd = svn_fs_x__dag_get_fs(node)->fsap_data;
+ const char *path = svn_fs_x__dag_get_created_path(node);
+ svn_fs_x__dag_cache_t *cache = ffd->dag_node_cache;
+
+ cache_entry_t *bucket;
+ svn_string_t normalized;
+
+ auto_clear_dag_cache(cache);
+ bucket = cache_lookup(cache, svn_fs_x__dag_get_id(node)->change_set,
+ normalize_path(&normalized, path));
+ bucket->node = svn_fs_x__dag_copy_into_pool(node, cache->pool);
+}
+
+void
svn_fs_x__invalidate_dag_cache(svn_fs_root_t *root,
const char *path)
{
@@ -543,7 +561,7 @@ try_match_last_node(dag_node_t **node_p,
&& memcmp(created_path, path->data, path->len) == 0)
{
/* Cache it under its full path@rev access path. */
- svn_fs_x__set_dag_node(root, created_path, node);
+ set_dag_node(root, created_path, node);
*node_p = node;
return SVN_NO_ERROR;
@@ -944,7 +962,7 @@ svn_fs_x__get_dag_path(svn_fs_x__dag_pat
/* Cache the node we found (if it wasn't already cached). */
if (! cached_node)
- svn_fs_x__set_dag_node(root, path_so_far->data, child);
+ set_dag_node(root, path_so_far->data, child);
}
/* Are we finished traversing the path? */
@@ -1050,8 +1068,7 @@ svn_fs_x__make_path_mutable(svn_fs_root_
subpool));
/* Update the path cache. */
- svn_fs_x__set_dag_node(root, parent_path_path(parent_path, subpool),
- clone);
+ svn_fs_x__update_dag_cache(clone);
svn_pool_destroy(subpool);
}
else
Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.h
URL:
http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.h?rev=1661004&r1=1661003&r2=1661004&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.h (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.h Thu Feb 19
21:03:11 2015
@@ -147,11 +147,9 @@ svn_fs_x__get_dag_node(dag_node_t **dag_
const char *path,
apr_pool_t *pool);
-/* Add the NODE for PATH to ROOT's node cache. */
+/* Add / update the NODE in the node cache. */
void
-svn_fs_x__set_dag_node(svn_fs_root_t *root,
- const char *path,
- dag_node_t *node);
+svn_fs_x__update_dag_cache(dag_node_t *node);
#ifdef __cplusplus
}
Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c
URL:
http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c?rev=1661004&r1=1661003&r2=1661004&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c Thu Feb 19
21:03:11 2015
@@ -1450,7 +1450,7 @@ x_make_dir(svn_fs_root_t *root,
subpool, subpool));
/* Add this directory to the path cache. */
- svn_fs_x__set_dag_node(root, parent_path_path(dag_path, subpool), sub_dir);
+ svn_fs_x__update_dag_cache(sub_dir);
/* Make a record of this modification in the changes table. */
SVN_ERR(add_change(root->fs, txn_id, path, svn_fs_x__dag_get_id(sub_dir),
@@ -1791,7 +1791,7 @@ x_make_file(svn_fs_root_t *root,
subpool, subpool));
/* Add this file to the path cache. */
- svn_fs_x__set_dag_node(root, parent_path_path(dag_path, subpool), child);
+ svn_fs_x__update_dag_cache(child);
/* Make a record of this modification in the changes table. */
SVN_ERR(add_change(root->fs, txn_id, path, svn_fs_x__dag_get_id(child),