Author: rhuijben
Date: Mon Apr 13 13:58:29 2015
New Revision: 1673197
URL: http://svn.apache.org/r1673197
Log:
Following up on r1673170, add the first fsfs tweaks to optimize obtaining the
boolean whether there are properties on a node.
* subversion/libsvn_fs_fs/cached_data.h
(svn_fs_fs__has_props): New function.
* subversion/libsvn_fs_fs/dag.c
(svn_fs_fs__dag_has_props): New function.
* subversion/libsvn_fs_fs/dag.h
(svn_fs_fs__dag_has_props): New function.
* subversion/libsvn_fs_fs/tree.c
(fs_node_has_props): Use svn_fs_fs__dag_has_props.
Modified:
subversion/trunk/subversion/libsvn_fs_fs/cached_data.h
subversion/trunk/subversion/libsvn_fs_fs/dag.c
subversion/trunk/subversion/libsvn_fs_fs/dag.h
subversion/trunk/subversion/libsvn_fs_fs/tree.c
Modified: subversion/trunk/subversion/libsvn_fs_fs/cached_data.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/cached_data.h?rev=1673197&r1=1673196&r2=1673197&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/cached_data.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/cached_data.h Mon Apr 13 13:58:29
2015
@@ -146,6 +146,14 @@ svn_fs_fs__get_proplist(apr_hash_t **pro
node_revision_t *noderev,
apr_pool_t *pool);
+/* Set *HAS_PROPS to TRUE if NODEREV has properties in FS, otherwise
+ to FALSE. Use SCRATCH_POOL for temporary allocations. */
+svn_error_t *
+svn_fs_fs__has_props(svn_boolean_t *has_props,
+ svn_fs_t *fs,
+ node_revision_t *noderev,
+ apr_pool_t *scratch_pool);
+
/* Fetch the list of change in revision REV in FS and return it in *CHANGES.
* Allocate the result in POOL.
*/
Modified: subversion/trunk/subversion/libsvn_fs_fs/dag.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/dag.c?rev=1673197&r1=1673196&r2=1673197&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/dag.c Mon Apr 13 13:58:29 2015
@@ -498,6 +498,46 @@ svn_fs_fs__dag_get_proplist(apr_hash_t *
return SVN_NO_ERROR;
}
+svn_error_t *
+svn_fs_fs__dag_has_props(svn_boolean_t *has_props,
+ dag_node_t *node,
+ apr_pool_t *scratch_pool)
+{
+ node_revision_t *noderev;
+
+ SVN_ERR(get_node_revision(&noderev, node));
+
+ if (! noderev->prop_rep)
+ {
+ *has_props = FALSE; /* Easy out */
+ return SVN_NO_ERROR;
+ }
+
+ if (svn_fs_fs__id_txn_used(&noderev->prop_rep->txn_id))
+ {
+ /* We are in a commit or something. Check actual properties */
+ apr_hash_t *proplist;
+
+ SVN_ERR(svn_fs_fs__get_proplist(&proplist, node->fs,
+ noderev, scratch_pool));
+
+ *has_props = proplist ? (0 < apr_hash_count(proplist)) : FALSE;
+ }
+ else
+ {
+ apr_hash_t *proplist;
+
+ /* ### Optimize further.
+ Stefan2 suggested: prop_rep exists and is longer than 4 bytes
+ */
+ SVN_ERR(svn_fs_fs__get_proplist(&proplist, node->fs,
+ noderev, scratch_pool));
+
+ *has_props = proplist ? (0 < apr_hash_count(proplist)) : FALSE;
+ }
+
+ return SVN_NO_ERROR;
+}
svn_error_t *
svn_fs_fs__dag_set_proplist(dag_node_t *node,
Modified: subversion/trunk/subversion/libsvn_fs_fs/dag.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/dag.h?rev=1673197&r1=1673196&r2=1673197&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/dag.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/dag.h Mon Apr 13 13:58:29 2015
@@ -177,6 +177,12 @@ svn_error_t *svn_fs_fs__dag_get_proplist
dag_node_t *node,
apr_pool_t *pool);
+/* Set *HAS_PROPS to TRUE if NODE has properties. Use SCRATCH_POOL
+ for temporary allocations */
+svn_error_t *svn_fs_fs__dag_has_props(svn_boolean_t *has_props,
+ dag_node_t *node,
+ apr_pool_t *scratch_pool);
+
/* Set the property list of NODE to PROPLIST, allocating from POOL.
The node being changed must be mutable.
Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1673197&r1=1673196&r2=1673197&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Mon Apr 13 13:58:29 2015
@@ -1521,13 +1521,12 @@ fs_node_has_props(svn_boolean_t *has_pro
const char *path,
apr_pool_t *scratch_pool)
{
- apr_hash_t *props;
+ dag_node_t *node;
- SVN_ERR(fs_node_proplist(&props, root, path, scratch_pool));
+ SVN_ERR(get_dag(&node, root, path, scratch_pool));
- *has_props = (0 < apr_hash_count(props));
-
- return SVN_NO_ERROR;
+ return svn_error_trace(svn_fs_fs__dag_has_props(has_props, node,
+ scratch_pool));
}
static svn_error_t *