You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/07/25 16:16:19 UTC

svn commit: r1506980 - /subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/dag.c

Author: stefan2
Date: Thu Jul 25 14:16:19 2013
New Revision: 1506980

URL: http://svn.apache.org/r1506980
Log:
On the fsfs-improvements branch:  Reimplement svn_fs_fs__dag_revision_root
eliminating the svn_fs_fs__dag_get_node call.  Since this getting root nodes
is a very frequent operation in some scenarios, we want it to be as quick
as possible.

* subversion/libsvn_fs_fs/dag.c
  (svn_fs_fs__dag_revision_root): manually construct the DAG root node

Modified:
    subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/dag.c

Modified: subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/dag.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/dag.c?rev=1506980&r1=1506979&r2=1506980&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/dag.c Thu Jul 25 14:16:19 2013
@@ -609,10 +609,24 @@ 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;
 }