subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1304844 - in /subversion/branches/node_pool/subversion/libsvn_fs_fs: dag.c dag.h tree.c
Date Sat, 24 Mar 2012 16:21:30 GMT
Author: danielsh
Date: Sat Mar 24 16:21:29 2012
New Revision: 1304844

URL: http://svn.apache.org/viewvc?rev=1304844&view=rev
Log:
Eliminate the DAG API's NODE_POOL, step 3.1.

Remove NODE_POOL parameters from get_node_revision()'s callers, through
the call in svn_fs_fs__dag_dir_entries() (line 418).

set_entry()/make_entry() may require additional changes; these will be done,
if needed, in a subsequent commit.

* subversion/libsvn_fs_fs/tree.c
  (*): Track removal of a POOL parameter.
  (get_mergeinfo_for_path): Also remove a now-unused iterpool.

* subversion/libsvn_fs_fs/dag.h
* subversion/libsvn_fs_fs/dag.c
  (svn_fs_fs__dag_delete_if_mutable): Track signature change.
  (make_entry): Update docstring.
  (svn_fs_fs__dag_get_predecessor_id,
   svn_fs_fs__dag_get_predecessor_count,
   svn_fs_fs__dag_get_mergeinfo_count,
   svn_fs_fs__dag_has_mergeinfo,
   svn_fs_fs__dag_has_descendants_with_mergeinfo,
   svn_fs_fs__dag_dir_entries):
     Removal POOL parameter. Update docs.

Modified:
    subversion/branches/node_pool/subversion/libsvn_fs_fs/dag.c
    subversion/branches/node_pool/subversion/libsvn_fs_fs/dag.h
    subversion/branches/node_pool/subversion/libsvn_fs_fs/tree.c

Modified: subversion/branches/node_pool/subversion/libsvn_fs_fs/dag.c
URL: http://svn.apache.org/viewvc/subversion/branches/node_pool/subversion/libsvn_fs_fs/dag.c?rev=1304844&r1=1304843&r2=1304844&view=diff
==============================================================================
--- subversion/branches/node_pool/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/branches/node_pool/subversion/libsvn_fs_fs/dag.c Sat Mar 24 16:21:29 2012
@@ -230,8 +230,7 @@ svn_fs_fs__dag_get_revision(svn_revnum_t
 
 svn_error_t *
 svn_fs_fs__dag_get_predecessor_id(const svn_fs_id_t **id_p,
-                                  dag_node_t *node,
-                                  apr_pool_t *pool)
+                                  dag_node_t *node)
 {
   node_revision_t *noderev;
 
@@ -243,8 +242,7 @@ svn_fs_fs__dag_get_predecessor_id(const 
 
 svn_error_t *
 svn_fs_fs__dag_get_predecessor_count(int *count,
-                                     dag_node_t *node,
-                                     apr_pool_t *pool)
+                                     dag_node_t *node)
 {
   node_revision_t *noderev;
 
@@ -255,8 +253,7 @@ svn_fs_fs__dag_get_predecessor_count(int
 
 svn_error_t *
 svn_fs_fs__dag_get_mergeinfo_count(apr_int64_t *count,
-                                   dag_node_t *node,
-                                   apr_pool_t *pool)
+                                   dag_node_t *node)
 {
   node_revision_t *noderev;
 
@@ -267,8 +264,7 @@ svn_fs_fs__dag_get_mergeinfo_count(apr_i
 
 svn_error_t *
 svn_fs_fs__dag_has_mergeinfo(svn_boolean_t *has_mergeinfo,
-                             dag_node_t *node,
-                             apr_pool_t *pool)
+                             dag_node_t *node)
 {
   node_revision_t *noderev;
 
@@ -279,8 +275,7 @@ svn_fs_fs__dag_has_mergeinfo(svn_boolean
 
 svn_error_t *
 svn_fs_fs__dag_has_descendants_with_mergeinfo(svn_boolean_t *do_they,
-                                              dag_node_t *node,
-                                              apr_pool_t *pool)
+                                              dag_node_t *node)
 {
   node_revision_t *noderev;
 
@@ -358,7 +353,7 @@ set_entry(dag_node_t *parent,
    will be a file.  The new node will be allocated in POOL.  PARENT
    must be mutable, and must not have an entry named NAME.
 
-   Use POOL for all allocations including caching the node_revision in PARENT.
+   Use POOL for all allocations, except caching the node_revision in PARENT.
  */
 static svn_error_t *
 make_entry(dag_node_t **child_p,
@@ -422,8 +417,7 @@ make_entry(dag_node_t **child_p,
 svn_error_t *
 svn_fs_fs__dag_dir_entries(apr_hash_t **entries,
                            dag_node_t *node,
-                           apr_pool_t *pool,
-                           apr_pool_t *node_pool)
+                           apr_pool_t *pool)
 {
   node_revision_t *noderev;
 
@@ -854,7 +848,7 @@ svn_fs_fs__dag_delete_if_mutable(svn_fs_
       apr_hash_index_t *hi;
 
       /* Loop over hash entries */
-      SVN_ERR(svn_fs_fs__dag_dir_entries(&entries, node, pool, pool));
+      SVN_ERR(svn_fs_fs__dag_dir_entries(&entries, node, pool));
       if (entries)
         {
           for (hi = apr_hash_first(pool, entries);

Modified: subversion/branches/node_pool/subversion/libsvn_fs_fs/dag.h
URL: http://svn.apache.org/viewvc/subversion/branches/node_pool/subversion/libsvn_fs_fs/dag.h?rev=1304844&r1=1304843&r2=1304844&view=diff
==============================================================================
--- subversion/branches/node_pool/subversion/libsvn_fs_fs/dag.h (original)
+++ subversion/branches/node_pool/subversion/libsvn_fs_fs/dag.h Sat Mar 24 16:21:29 2012
@@ -121,58 +121,39 @@ const char *svn_fs_fs__dag_get_created_p
 
 
 /* Set *ID_P to the node revision ID of NODE's immediate predecessor,
-   or NULL if NODE has no predecessor, allocating from POOL.
-
-   Use POOL for all allocations, including to cache the node_revision in
-   NODE.
+   or NULL if NODE has no predecessor.
  */
 svn_error_t *svn_fs_fs__dag_get_predecessor_id(const svn_fs_id_t **id_p,
-                                               dag_node_t *node,
-                                               apr_pool_t *pool);
+                                               dag_node_t *node);
 
 
 /* Set *COUNT to the number of predecessors NODE has (recursively), or
-   -1 if not known, allocating from POOL.
-
-   Use POOL for all allocations, including to cache the node_revision in
-   NODE.
+   -1 if not known.
  */
+/* ### This function is currently only used by 'verify'. */
 svn_error_t *svn_fs_fs__dag_get_predecessor_count(int *count,
-                                                  dag_node_t *node,
-                                                  apr_pool_t *pool);
+                                                  dag_node_t *node);
 
 /* Set *COUNT to the number of node under NODE (inclusive) with
-   svn:mergeinfo properties, allocating from POOL.
-
-   Use POOL for all allocations, including to cache the node_revision in
-   NODE.
+   svn:mergeinfo properties.
  */
 svn_error_t *svn_fs_fs__dag_get_mergeinfo_count(apr_int64_t *count,
-                                                dag_node_t *node,
-                                                apr_pool_t *pool);
+                                                dag_node_t *node);
 
 /* Set *DO_THEY to a flag indicating whether or not NODE is a
    directory with at least one descendant (not including itself) with
    svn:mergeinfo.
-
-   Use POOL for all allocations, including to cache the node_revision in
-   NODE.
  */
 svn_error_t *
 svn_fs_fs__dag_has_descendants_with_mergeinfo(svn_boolean_t *do_they,
-                                              dag_node_t *node,
-                                              apr_pool_t *pool);
+                                              dag_node_t *node);
 
 /* Set *HAS_MERGEINFO to a flag indicating whether or not NODE itself
    has svn:mergeinfo set on it.
-
-   Use POOL for all allocations, including to cache the node_revision in
-   NODE.
  */
 svn_error_t *
 svn_fs_fs__dag_has_mergeinfo(svn_boolean_t *has_mergeinfo,
-                             dag_node_t *node,
-                             apr_pool_t *pool);
+                             dag_node_t *node);
 
 /* Return non-zero IFF NODE is currently mutable. */
 svn_boolean_t svn_fs_fs__dag_check_mutable(const dag_node_t *node);
@@ -289,13 +270,10 @@ svn_error_t *svn_fs_fs__dag_open(dag_nod
 /* Set *ENTRIES_P to a hash table of NODE's entries.  The keys of the
    table are entry names, and the values are svn_fs_dirent_t's.  The
    returned table (and its keys and values) is allocated in POOL,
-   which is also used for temporary allocations.  NODE_POOL is used
-   for any allocation of memory that needs to live as long as NODE
-   lives. */
+   which is also used for temporary allocations. */
 svn_error_t *svn_fs_fs__dag_dir_entries(apr_hash_t **entries_p,
                                         dag_node_t *node,
-                                        apr_pool_t *pool,
-                                        apr_pool_t *node_pool);
+                                        apr_pool_t *pool);
 
 /* 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

Modified: subversion/branches/node_pool/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/node_pool/subversion/libsvn_fs_fs/tree.c?rev=1304844&r1=1304843&r2=1304844&view=diff
==============================================================================
--- subversion/branches/node_pool/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/node_pool/subversion/libsvn_fs_fs/tree.c Sat Mar 24 16:21:29 2012
@@ -1072,8 +1072,7 @@ fs_change_node_prop(svn_fs_root_t *root,
     {
       apr_int64_t increment = 0;
       svn_boolean_t had_mergeinfo;
-      SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&had_mergeinfo, parent_path->node,
-                                           pool));
+      SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&had_mergeinfo, parent_path->node));
 
       if (value && !had_mergeinfo)
         increment = 1;
@@ -1337,9 +1336,9 @@ merge(svn_stringbuf_t *conflict_p,
   /* ### todo: it would be more efficient to simply check for a NULL
      entries hash where necessary below than to allocate an empty hash
      here, but another day, another day... */
-  SVN_ERR(svn_fs_fs__dag_dir_entries(&s_entries, source, pool, pool));
-  SVN_ERR(svn_fs_fs__dag_dir_entries(&t_entries, target, pool, pool));
-  SVN_ERR(svn_fs_fs__dag_dir_entries(&a_entries, ancestor, pool, pool));
+  SVN_ERR(svn_fs_fs__dag_dir_entries(&s_entries, source, pool));
+  SVN_ERR(svn_fs_fs__dag_dir_entries(&t_entries, target, pool));
+  SVN_ERR(svn_fs_fs__dag_dir_entries(&a_entries, ancestor, pool));
 
   /* for each entry E in a_entries... */
   iterpool = svn_pool_create(pool);
@@ -1376,8 +1375,7 @@ merge(svn_stringbuf_t *conflict_p,
             {
               apr_int64_t mergeinfo_start;
               SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_start,
-                                                         t_ent_node,
-                                                         iterpool));
+                                                         t_ent_node));
               mergeinfo_increment -= mergeinfo_start;
             }
 
@@ -1391,8 +1389,7 @@ merge(svn_stringbuf_t *conflict_p,
                 {
                   apr_int64_t mergeinfo_end;
                   SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_end,
-                                                             s_ent_node,
-                                                             iterpool));
+                                                             s_ent_node));
                   mergeinfo_increment += mergeinfo_end;
                 }
 
@@ -1505,8 +1502,7 @@ merge(svn_stringbuf_t *conflict_p,
         {
           apr_int64_t mergeinfo_s;
           SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_s,
-                                                     s_ent_node,
-                                                     iterpool));
+                                                     s_ent_node));
           mergeinfo_increment += mergeinfo_s;
         }
 
@@ -1803,7 +1799,7 @@ fs_dir_entries(apr_hash_t **table_p,
 
   /* Get the entries for this path in the caller's pool. */
   SVN_ERR(get_dag(&node, root, path, pool));
-  return svn_fs_fs__dag_dir_entries(table_p, node, pool, pool);
+  return svn_fs_fs__dag_dir_entries(table_p, node, pool);
 }
 
 
@@ -1889,8 +1885,7 @@ fs_delete_node(svn_fs_root_t *root,
   SVN_ERR(make_path_mutable(root, parent_path->parent, path, pool));
   if (svn_fs_fs__fs_supports_mergeinfo(root->fs))
     SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_count,
-                                               parent_path->node,
-                                               pool));
+                                               parent_path->node));
   SVN_ERR(svn_fs_fs__dag_delete(parent_path->parent->node,
                                 parent_path->entry,
                                 txn_id, pool));
@@ -2005,8 +2000,7 @@ copy_helper(svn_fs_root_t *from_root,
           kind = svn_fs_path_change_replace;
           if (svn_fs_fs__fs_supports_mergeinfo(to_root->fs))
             SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_start,
-                                                       to_parent_path->node,
-                                                       pool));
+                                                       to_parent_path->node));
         }
       else
         {
@@ -2016,7 +2010,7 @@ copy_helper(svn_fs_root_t *from_root,
 
       if (svn_fs_fs__fs_supports_mergeinfo(to_root->fs))
         SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_end,
-                                                   from_node, pool));
+                                                   from_node));
 
       /* Make sure the target node's parents are mutable.  */
       SVN_ERR(make_path_mutable(to_root, to_parent_path->parent,
@@ -2872,7 +2866,7 @@ static svn_error_t *fs_closest_copy(svn_
   if (created_rev == copy_dst_rev)
     {
       const svn_fs_id_t *pred;
-      SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred, copy_dst_node, pool));
+      SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred, copy_dst_node));
       if (! pred)
         return SVN_NO_ERROR;
     }
@@ -3033,7 +3027,7 @@ fs_node_origin_rev(svn_revnum_t *revisio
            value cached in the node (which is allocated in
            SUBPOOL... maybe). */
         svn_pool_clear(predidpool);
-        SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, node, subpool));
+        SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, node));
         pred_id = pred_id ? svn_fs_fs__id_copy(pred_id, predidpool) : NULL;
       }
     while (pred_id);
@@ -3135,7 +3129,7 @@ history_prev(void *baton, apr_pool_t *po
              no predecessor, in which case we're all done!). */
           const svn_fs_id_t *pred_id;
 
-          SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, node, pool));
+          SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, node));
           if (! pred_id)
             return SVN_NO_ERROR;
 
@@ -3348,7 +3342,7 @@ crawl_directory_dag_for_mergeinfo(svn_fs
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
 
   SVN_ERR(svn_fs_fs__dag_dir_entries(&entries, dir_dag,
-                                     scratch_pool, scratch_pool));
+                                     scratch_pool));
 
   for (hi = apr_hash_first(scratch_pool, entries);
        hi;
@@ -3364,9 +3358,8 @@ crawl_directory_dag_for_mergeinfo(svn_fs
       kid_path = svn_fspath__join(this_path, dirent->name, iterpool);
       SVN_ERR(get_dag(&kid_dag, root, kid_path, iterpool));
 
-      SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&has_mergeinfo, kid_dag, iterpool));
-      SVN_ERR(svn_fs_fs__dag_has_descendants_with_mergeinfo(&go_down, kid_dag,
-                                                            iterpool));
+      SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&has_mergeinfo, kid_dag));
+      SVN_ERR(svn_fs_fs__dag_has_descendants_with_mergeinfo(&go_down, kid_dag));
 
       if (has_mergeinfo)
         {
@@ -3441,7 +3434,6 @@ get_mergeinfo_for_path(svn_mergeinfo_t *
   parent_path_t *parent_path, *nearest_ancestor;
   apr_hash_t *proplist;
   svn_string_t *mergeinfo_string;
-  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
 
   *mergeinfo = NULL;
 
@@ -3461,17 +3453,14 @@ get_mergeinfo_for_path(svn_mergeinfo_t *
     {
       svn_boolean_t has_mergeinfo;
 
-      svn_pool_clear(iterpool);
-
       SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&has_mergeinfo,
-                                           nearest_ancestor->node, iterpool));
+                                           nearest_ancestor->node));
       if (has_mergeinfo)
         break;
 
       /* No need to loop if we're looking for explicit mergeinfo. */
       if (inherit == svn_mergeinfo_explicit)
         {
-          svn_pool_destroy(iterpool);
           return SVN_NO_ERROR;
         }
 
@@ -3480,13 +3469,10 @@ get_mergeinfo_for_path(svn_mergeinfo_t *
       /* Run out?  There's no mergeinfo. */
       if (!nearest_ancestor)
         {
-          svn_pool_destroy(iterpool);
           return SVN_NO_ERROR;
         }
     }
 
-  svn_pool_destroy(iterpool);
-
   SVN_ERR(svn_fs_fs__dag_get_proplist(&proplist, nearest_ancestor->node,
                                       scratch_pool));
   mergeinfo_string = apr_hash_get(proplist, SVN_PROP_MERGEINFO,
@@ -3554,8 +3540,7 @@ add_descendant_mergeinfo(svn_mergeinfo_c
 
   SVN_ERR(get_dag(&this_dag, root, path, scratch_pool));
   SVN_ERR(svn_fs_fs__dag_has_descendants_with_mergeinfo(&go_down,
-                                                        this_dag,
-                                                        scratch_pool));
+                                                        this_dag));
   if (go_down)
     SVN_ERR(crawl_directory_dag_for_mergeinfo(root,
                                               path,
@@ -3788,8 +3773,7 @@ stringify_node(dag_node_t *node,
 static svn_error_t *
 verify_node(dag_node_t *node,
             svn_revnum_t rev,
-            apr_pool_t *pool,
-            apr_pool_t *node_pool)
+            apr_pool_t *pool)
 {
   svn_boolean_t has_mergeinfo;
   apr_int64_t mergeinfo_count;
@@ -3800,10 +3784,10 @@ verify_node(dag_node_t *node,
   apr_pool_t *iterpool = svn_pool_create(pool);
 
   /* Fetch some data. */
-  SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&has_mergeinfo, node, node_pool));
-  SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_count, node, node_pool));
-  SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, node, node_pool));
-  SVN_ERR(svn_fs_fs__dag_get_predecessor_count(&pred_count, node, node_pool));
+  SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&has_mergeinfo, node));
+  SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_count, node));
+  SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, node));
+  SVN_ERR(svn_fs_fs__dag_get_predecessor_count(&pred_count, node));
   kind = svn_fs_fs__dag_node_kind(node);
 
   /* Sanity check. */
@@ -3819,8 +3803,7 @@ verify_node(dag_node_t *node,
       dag_node_t *pred;
       int pred_pred_count;
       SVN_ERR(svn_fs_fs__dag_get_node(&pred, fs, pred_id, iterpool));
-      SVN_ERR(svn_fs_fs__dag_get_predecessor_count(&pred_pred_count, pred,
-                                                   iterpool));
+      SVN_ERR(svn_fs_fs__dag_get_predecessor_count(&pred_pred_count, pred));
       if (pred_pred_count+1 != pred_count)
         return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
                                  "Predecessor count mismatch: "
@@ -3851,7 +3834,7 @@ verify_node(dag_node_t *node,
       apr_hash_index_t *hi;
       apr_int64_t children_mergeinfo = 0;
 
-      SVN_ERR(svn_fs_fs__dag_dir_entries(&entries, node, pool, node_pool));
+      SVN_ERR(svn_fs_fs__dag_dir_entries(&entries, node, pool));
 
       /* Compute CHILDREN_MERGEINFO. */
       /* ### TODO: iterpool? */
@@ -3871,10 +3854,9 @@ verify_node(dag_node_t *node,
           SVN_ERR(svn_fs_fs__dag_get_revision(&child_rev, child, iterpool));
 
           if (child_rev == rev)
-            SVN_ERR(verify_node(child, rev, iterpool, iterpool));
+            SVN_ERR(verify_node(child, rev, iterpool));
 
-          SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&child_mergeinfo, child,
-                                                     iterpool));
+          SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&child_mergeinfo, child));
           children_mergeinfo += child_mergeinfo;
         }
 
@@ -3905,7 +3887,7 @@ svn_fs_fs__verify_root(svn_fs_root_t *ro
   frd = root->fsap_data;
 
   /* Recursively verify ROOT_DIR. */
-  SVN_ERR(verify_node(frd->root_dir, root->rev, pool, pool));
+  SVN_ERR(verify_node(frd->root_dir, root->rev, pool));
 
   /* Verify explicitly the predecessor of the root. */
   {
@@ -3914,7 +3896,7 @@ svn_fs_fs__verify_root(svn_fs_root_t *ro
     svn_revnum_t pred_rev;
 
     /* Only r0 should have no predecessor. */
-    SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, frd->root_dir, pool));
+    SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, frd->root_dir));
     if (!!pred_id != !!root->rev)
       return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
                                "r%ld's root node's predecessor is "



Mime
View raw message