Author: stefan2
Date: Sat Jan 17 12:22:02 2015
New Revision: 1652590

URL: http://svn.apache.org/r1652590
Log:
In FSX, switch svn_fs_x__get_proplist() to the 2-pool paradigm.
Propagate that change along the call stack.

* subversion/libsvn_fs_x/cached_data.h
  (svn_fs_x__get_proplist): Switch declaration to the new paradigm.

* subversion/libsvn_fs_x/cached_data.c
  (svn_fs_x__get_proplist): Use two pools now.

* subversion/libsvn_fs_x/dag.c
  (svn_fs_x__dag_get_proplist): Bump caller to using 2 pools as well.

* subversion/libsvn_fs_x/dag.h
  (svn_fs_x__dag_get_proplist): Update declaration to match the definition.

* subversion/libsvn_fs_x/fs_x.c
  (svn_fs_x__prop_rep_equal): Update caller.

* subversion/libsvn_fs_x/transaction.c
  (write_final_rev): Same.

* subversion/libsvn_fs_x/tree.c
  (x_node_prop,
   x_node_proplist): Update callers. Create a local SCRATCH_POOL because
                     the FS API doesn't give us one.
  (x_change_node_prop,
   crawl_directory_dag_for_mergeinfo,
   get_mergeinfo_for_path_internal): Update callers.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/cached_data.c
    subversion/trunk/subversion/libsvn_fs_x/cached_data.h
    subversion/trunk/subversion/libsvn_fs_x/dag.c
    subversion/trunk/subversion/libsvn_fs_x/dag.h
    subversion/trunk/subversion/libsvn_fs_x/fs_x.c
    subversion/trunk/subversion/libsvn_fs_x/transaction.c
    subversion/trunk/subversion/libsvn_fs_x/tree.c

Modified: subversion/trunk/subversion/libsvn_fs_x/cached_data.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/cached_data.c?rev=1652590&r1=1652589&r2=1652590&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/cached_data.c Sat Jan 17 12:22:02 
2015
@@ -2748,7 +2748,8 @@ svn_error_t *
 svn_fs_x__get_proplist(apr_hash_t **proplist_p,
                        svn_fs_t *fs,
                        svn_fs_x__noderev_t *noderev,
-                       apr_pool_t *pool)
+                       apr_pool_t *result_pool,
+                       apr_pool_t *scratch_pool)
 {
   apr_hash_t *proplist;
   svn_stream_t *stream;
@@ -2757,12 +2758,15 @@ svn_fs_x__get_proplist(apr_hash_t **prop
   if (noderev->prop_rep
       && !svn_fs_x__is_revision(noderev->prop_rep->id.change_set))
     {
-      const char *filename
-        = svn_fs_x__path_txn_node_props(fs, noderev_id, pool, pool);
-      proplist = apr_hash_make(pool);
-
-      SVN_ERR(svn_stream_open_readonly(&stream, filename, pool, pool));
-      SVN_ERR(svn_hash_read2(proplist, stream, SVN_HASH_TERMINATOR, pool));
+      const char *filename = svn_fs_x__path_txn_node_props(fs, noderev_id,
+                                                           scratch_pool,
+                                                           scratch_pool);
+      proplist = apr_hash_make(result_pool);
+
+      SVN_ERR(svn_stream_open_readonly(&stream, filename, scratch_pool,
+                                       scratch_pool));
+      SVN_ERR(svn_hash_read2(proplist, stream, SVN_HASH_TERMINATOR,
+                             result_pool));
       SVN_ERR(svn_stream_close(stream));
     }
   else if (noderev->prop_rep)
@@ -2777,24 +2781,26 @@ svn_fs_x__get_proplist(apr_hash_t **prop
         {
           svn_boolean_t is_cached;
           SVN_ERR(svn_cache__get((void **) proplist_p, &is_cached,
-                                 ffd->properties_cache, &key, pool));
+                                 ffd->properties_cache, &key, result_pool));
           if (is_cached)
             return SVN_NO_ERROR;
         }
 
-      proplist = apr_hash_make(pool);
+      proplist = apr_hash_make(result_pool);
       SVN_ERR(svn_fs_x__get_contents(&stream, fs, noderev->prop_rep, FALSE,
-                                     pool));
-      SVN_ERR(svn_hash_read2(proplist, stream, SVN_HASH_TERMINATOR, pool));
+                                     scratch_pool));
+      SVN_ERR(svn_hash_read2(proplist, stream, SVN_HASH_TERMINATOR,
+                             result_pool));
       SVN_ERR(svn_stream_close(stream));
 
       if (ffd->properties_cache && SVN_IS_VALID_REVNUM(rep->id.change_set))
-        SVN_ERR(svn_cache__set(ffd->properties_cache, &key, proplist, pool));
+        SVN_ERR(svn_cache__set(ffd->properties_cache, &key, proplist,
+                               scratch_pool));
     }
   else
     {
       /* return an empty prop list if the node doesn't have any props */
-      proplist = apr_hash_make(pool);
+      proplist = apr_hash_make(result_pool);
     }
 
   *proplist_p = proplist;

Modified: subversion/trunk/subversion/libsvn_fs_x/cached_data.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/cached_data.h?rev=1652590&r1=1652589&r2=1652590&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/cached_data.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/cached_data.h Sat Jan 17 12:22:02 
2015
@@ -158,13 +158,14 @@ svn_fs_x__rep_contents_dir_entry(svn_fs_
                                  apr_pool_t *scratch_pool);
 
 /* Set *PROPLIST to be an apr_hash_t containing the property list of
-   node-revision NODEREV as seen in filesystem FS.  Use POOL for
-   temporary allocations. */
+   node-revision NODEREV as seen in filesystem FS.  Allocate the result
+   in RESULT_POOL and use SCRATCH_POOL for temporary allocations. */
 svn_error_t *
 svn_fs_x__get_proplist(apr_hash_t **proplist,
                        svn_fs_t *fs,
                        svn_fs_x__noderev_t *noderev,
-                       apr_pool_t *pool);
+                       apr_pool_t *result_pool,
+                       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_x/dag.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.c?rev=1652590&r1=1652589&r2=1652590&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.c Sat Jan 17 12:22:02 2015
@@ -525,14 +525,16 @@ svn_fs_x__dag_set_entry(dag_node_t *node
 svn_error_t *
 svn_fs_x__dag_get_proplist(apr_hash_t **proplist_p,
                            dag_node_t *node,
-                           apr_pool_t *pool)
+                           apr_pool_t *result_pool,
+                           apr_pool_t *scratch_pool)
 {
   svn_fs_x__noderev_t *noderev;
   apr_hash_t *proplist = NULL;
 
   SVN_ERR(get_node_revision(&noderev, node));
 
-  SVN_ERR(svn_fs_x__get_proplist(&proplist, node->fs, noderev, pool));
+  SVN_ERR(svn_fs_x__get_proplist(&proplist, node->fs, noderev, result_pool,
+                                 scratch_pool));
 
   *proplist_p = proplist;
 

Modified: subversion/trunk/subversion/libsvn_fs_x/dag.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.h?rev=1652590&r1=1652589&r2=1652590&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.h Sat Jan 17 12:22:02 2015
@@ -208,12 +208,13 @@ svn_fs_x__dag_node_kind(dag_node_t *node
    If properties do not exist on NODE, *PROPLIST_P will be set to
    NULL.
 
-   Use POOL for all allocations.
+   Allocate the result in RESULT_POOL and use SCRATCH_POOL for temporaries. 
  */
 svn_error_t *
 svn_fs_x__dag_get_proplist(apr_hash_t **proplist_p,
                            dag_node_t *node,
-                           apr_pool_t *pool);
+                           apr_pool_t *result_pool,
+                           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_x/fs_x.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs_x.c?rev=1652590&r1=1652589&r2=1652590&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs_x.c Sat Jan 17 12:22:02 2015
@@ -788,8 +788,10 @@ svn_fs_x__prop_rep_equal(svn_boolean_t *
 
   /* At least one of the reps has been modified in a txn.
      Fetch and compare them. */
-  SVN_ERR(svn_fs_x__get_proplist(&proplist_a, fs, a, scratch_pool));
-  SVN_ERR(svn_fs_x__get_proplist(&proplist_b, fs, b, scratch_pool));
+  SVN_ERR(svn_fs_x__get_proplist(&proplist_a, fs, a, scratch_pool,
+                                 scratch_pool));
+  SVN_ERR(svn_fs_x__get_proplist(&proplist_b, fs, b, scratch_pool,
+                                 scratch_pool));
 
   *equal = svn_fs__prop_lists_equal(proplist_a, proplist_b, scratch_pool);
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.c?rev=1652590&r1=1652589&r2=1652590&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.c Sat Jan 17 12:22:02 
2015
@@ -2897,7 +2897,8 @@ write_final_rev(svn_fs_x__id_t *new_id_p
       apr_uint32_t item_type = noderev->kind == svn_node_dir
                              ? SVN_FS_X__ITEM_TYPE_DIR_PROPS
                              : SVN_FS_X__ITEM_TYPE_FILE_PROPS;
-      SVN_ERR(svn_fs_x__get_proplist(&proplist, fs, noderev, scratch_pool));
+      SVN_ERR(svn_fs_x__get_proplist(&proplist, fs, noderev, scratch_pool,
+                                     scratch_pool));
 
       noderev->prop_rep->id.change_set = change_set;
 

Modified: subversion/trunk/subversion/libsvn_fs_x/tree.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/tree.c?rev=1652590&r1=1652589&r2=1652590&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/tree.c Sat Jan 17 12:22:02 2015
@@ -1467,13 +1467,15 @@ x_node_prop(svn_string_t **value_p,
 {
   dag_node_t *node;
   apr_hash_t *proplist;
+  apr_pool_t *scratch_pool = svn_pool_create(pool);
 
   SVN_ERR(get_dag(&node, root, path,  pool));
-  SVN_ERR(svn_fs_x__dag_get_proplist(&proplist, node, pool));
+  SVN_ERR(svn_fs_x__dag_get_proplist(&proplist, node, pool, scratch_pool));
   *value_p = NULL;
   if (proplist)
     *value_p = svn_hash_gets(proplist, propname);
 
+  svn_pool_destroy(scratch_pool);
   return SVN_NO_ERROR;
 }
 
@@ -1488,13 +1490,13 @@ x_node_proplist(apr_hash_t **table_p,
                 const char *path,
                 apr_pool_t *pool)
 {
-  apr_hash_t *table;
   dag_node_t *node;
+  apr_pool_t *scratch_pool = svn_pool_create(pool);
 
   SVN_ERR(get_dag(&node, root, path, pool));
-  SVN_ERR(svn_fs_x__dag_get_proplist(&table, node, pool));
-  *table_p = table ? table : apr_hash_make(pool);
+  SVN_ERR(svn_fs_x__dag_get_proplist(table_p, node, pool, scratch_pool));
 
+  svn_pool_destroy(scratch_pool);
   return SVN_NO_ERROR;
 }
 
@@ -1544,7 +1546,8 @@ x_change_node_prop(svn_fs_root_t *root,
                                              subpool));
 
   SVN_ERR(make_path_mutable(root, parent_path, path, subpool, subpool));
-  SVN_ERR(svn_fs_x__dag_get_proplist(&proplist, parent_path->node, subpool));
+  SVN_ERR(svn_fs_x__dag_get_proplist(&proplist, parent_path->node, subpool,
+                                     subpool));
 
   /* If there's no proplist, but we're just deleting a property, exit now. */
   if ((! proplist) && (! value))
@@ -3844,7 +3847,8 @@ crawl_directory_dag_for_mergeinfo(svn_fs
           svn_string_t *mergeinfo_string;
           svn_error_t *err;
 
-          SVN_ERR(svn_fs_x__dag_get_proplist(&proplist, kid_dag, iterpool));
+          SVN_ERR(svn_fs_x__dag_get_proplist(&proplist, kid_dag, iterpool,
+                                             iterpool));
           mergeinfo_string = svn_hash_gets(proplist, SVN_PROP_MERGEINFO);
           if (!mergeinfo_string)
             {
@@ -3963,7 +3967,7 @@ get_mergeinfo_for_path_internal(svn_merg
     }
 
   SVN_ERR(svn_fs_x__dag_get_proplist(&proplist, nearest_ancestor->node,
-                                     scratch_pool));
+                                     scratch_pool, scratch_pool));
   mergeinfo_string = svn_hash_gets(proplist, SVN_PROP_MERGEINFO);
   if (!mergeinfo_string)
     return svn_error_createf


Reply via email to