subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1604836 - in /subversion/trunk/subversion/libsvn_fs_fs: cached_data.c cached_data.h dag.c low_level.c low_level.h pack.c recovery.c transaction.c
Date Mon, 23 Jun 2014 15:04:59 GMT
Author: rhuijben
Date: Mon Jun 23 15:04:59 2014
New Revision: 1604836

URL: http://svn.apache.org/r1604836
Log:
Switch svn_fs_fs__rev_get_root() and svn_fs_fs__read_noderev() to the dual
pool pattern.

* subversion/libsvn_fs_fs/cached_data.c
  (get_node_revision_body,
   get_fs_id_at_offset): Update caller.
  (svn_fs_fs__rev_get_root): Use scratch pool for temporary work.
  (block_read_noderev): Update caller.

* subversion/libsvn_fs_fs/cached_data.h
  (svn_fs_fs__rev_get_root): Change to dual pool.

* subversion/libsvn_fs_fs/dag.c
  (svn_fs_fs__dag_revision_root): Update caller.

* subversion/libsvn_fs_fs/low_level.c
  (svn_fs_fs__read_noderev): Read data in scratch pool as it is copied anyway.

* subversion/libsvn_fs_fs/low_level.h
  (svn_fs_fs__read_noderev): Change to dual pool.

* subversion/libsvn_fs_fs/pack.c
  (copy_node_to_temp): Update caller.

* subversion/libsvn_fs_fs/recovery.c
  (recover_find_max_ids): Update caller.

* subversion/libsvn_fs_fs/transaction.c
  (svn_fs_fs__create_txn): Update caller.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/cached_data.c
    subversion/trunk/subversion/libsvn_fs_fs/cached_data.h
    subversion/trunk/subversion/libsvn_fs_fs/dag.c
    subversion/trunk/subversion/libsvn_fs_fs/low_level.c
    subversion/trunk/subversion/libsvn_fs_fs/low_level.h
    subversion/trunk/subversion/libsvn_fs_fs/pack.c
    subversion/trunk/subversion/libsvn_fs_fs/recovery.c
    subversion/trunk/subversion/libsvn_fs_fs/transaction.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/cached_data.c?rev=1604836&r1=1604835&r2=1604836&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/cached_data.c Mon Jun 23 15:04:59 2014
@@ -318,7 +318,7 @@ get_node_revision_body(node_revision_t *
                                       svn_stream_from_aprfile2(file,
                                                                FALSE,
                                                                scratch_pool),
-                                      result_pool));
+                                      result_pool, scratch_pool));
     }
   else
     {
@@ -365,7 +365,8 @@ get_node_revision_body(node_revision_t *
           /* physical addressing mode reading, parsing and caching */
           SVN_ERR(svn_fs_fs__read_noderev(noderev_p,
                                           revision_file->stream,
-                                          result_pool));
+                                          result_pool,
+                                          scratch_pool));
 
           /* Workaround issue #4031: is-fresh-txn-root in revision files. */
           (*noderev_p)->is_fresh_txn_root = FALSE;
@@ -430,7 +431,7 @@ get_fs_id_at_offset(svn_fs_id_t **id_p,
   SVN_ERR(aligned_seek(fs, rev_file->file, NULL, offset, pool));
   SVN_ERR(svn_fs_fs__read_noderev(&noderev,
                                   rev_file->stream,
-                                  pool));
+                                  pool, pool));
 
   /* noderev->id is const, get rid of that */
   *id_p = svn_fs_fs__id_copy(noderev->id, pool);
@@ -543,14 +544,15 @@ svn_error_t *
 svn_fs_fs__rev_get_root(svn_fs_id_t **root_id_p,
                         svn_fs_t *fs,
                         svn_revnum_t rev,
-                        apr_pool_t *pool)
+                        apr_pool_t *result_pool,
+                        apr_pool_t *scratch_pool)
 {
   fs_fs_data_t *ffd = fs->fsap_data;
-  SVN_ERR(svn_fs_fs__ensure_revision_exists(rev, fs, pool));
+  SVN_ERR(svn_fs_fs__ensure_revision_exists(rev, fs, scratch_pool));
 
   if (svn_fs_fs__use_log_addressing(fs, rev))
     {
-      *root_id_p = svn_fs_fs__id_create_root(rev, pool);
+      *root_id_p = svn_fs_fs__id_create_root(rev, result_pool);
     }
   else
     {
@@ -560,20 +562,23 @@ svn_fs_fs__rev_get_root(svn_fs_id_t **ro
       svn_boolean_t is_cached;
 
       SVN_ERR(svn_cache__get((void **) root_id_p, &is_cached,
-                            ffd->rev_root_id_cache, &rev, pool));
+                            ffd->rev_root_id_cache, &rev, result_pool));
       if (is_cached)
         return SVN_NO_ERROR;
 
-      SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&revision_file, fs, rev, pool));
+      SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&revision_file, fs, rev,
+                                               scratch_pool));
       SVN_ERR(get_root_changes_offset(&root_offset, NULL,
-                                      revision_file->file, fs, rev, pool));
+                                      revision_file->file, fs, rev,
+                                      scratch_pool));
 
       SVN_ERR(get_fs_id_at_offset(&root_id, revision_file, fs, rev,
-                                  root_offset, pool));
+                                  root_offset, result_pool));
 
       SVN_ERR(svn_fs_fs__close_revision_file(revision_file));
 
-      SVN_ERR(svn_cache__set(ffd->rev_root_id_cache, &rev, root_id, pool));
+      SVN_ERR(svn_cache__set(ffd->rev_root_id_cache, &rev, root_id,
+                             scratch_pool));
 
       *root_id_p = root_id;
     }
@@ -3144,7 +3149,8 @@ block_read_noderev(node_revision_t **nod
 
   /* read node rev from revision file */
 
-  SVN_ERR(svn_fs_fs__read_noderev(noderev_p, stream, result_pool));
+  SVN_ERR(svn_fs_fs__read_noderev(noderev_p, stream,
+                                  result_pool, scratch_pool));
 
   /* Workaround issue #4031: is-fresh-txn-root in revision files. */
   (*noderev_p)->is_fresh_txn_root = FALSE;

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=1604836&r1=1604835&r2=1604836&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/cached_data.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/cached_data.h Mon Jun 23 15:04:59 2014
@@ -45,7 +45,8 @@ svn_error_t *
 svn_fs_fs__rev_get_root(svn_fs_id_t **root_id,
                         svn_fs_t *fs,
                         svn_revnum_t rev,
-                        apr_pool_t *pool);
+                        apr_pool_t *result_pool,
+                        apr_pool_t *scratch_pool);
 
 /* Verify that representation REP in FS can be accessed.  Successive calls
    to this function should pass a non-NULL value to HINT.  In that case,

Modified: subversion/trunk/subversion/libsvn_fs_fs/dag.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/dag.c?rev=1604836&r1=1604835&r2=1604836&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/dag.c Mon Jun 23 15:04:59 2014
@@ -617,7 +617,7 @@ svn_fs_fs__dag_revision_root(dag_node_t 
   /* 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));
+  SVN_ERR(svn_fs_fs__rev_get_root(&new_node->id, fs, rev, pool, pool));
 
   /* Grab the contents so we can inspect the node's kind and created path. */
   new_node->node_pool = pool;

Modified: subversion/trunk/subversion/libsvn_fs_fs/low_level.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/low_level.c?rev=1604836&r1=1604835&r2=1604836&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/low_level.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/low_level.c Mon Jun 23 15:04:59 2014
@@ -758,16 +758,17 @@ read_rep_offsets(representation_t **rep_
 svn_error_t *
 svn_fs_fs__read_noderev(node_revision_t **noderev_p,
                         svn_stream_t *stream,
-                        apr_pool_t *pool)
+                        apr_pool_t *result_pool,
+                        apr_pool_t *scratch_pool)
 {
   apr_hash_t *headers;
   node_revision_t *noderev;
   char *value;
   const char *noderev_id;
 
-  SVN_ERR(read_header_block(&headers, stream, pool));
+  SVN_ERR(read_header_block(&headers, stream, scratch_pool));
 
-  noderev = apr_pcalloc(pool, sizeof(*noderev));
+  noderev = apr_pcalloc(result_pool, sizeof(*noderev));
 
   /* Read the node-rev id. */
   value = svn_hash_gets(headers, HEADER_ID);
@@ -778,7 +779,7 @@ svn_fs_fs__read_noderev(node_revision_t 
 
   SVN_ERR(svn_stream_close(stream));
 
-  noderev->id = svn_fs_fs__id_parse(value, strlen(value), pool);
+  noderev->id = svn_fs_fs__id_parse(value, strlen(value), result_pool);
   noderev_id = value; /* for error messages later */
 
   /* Read the type. */
@@ -808,7 +809,7 @@ svn_fs_fs__read_noderev(node_revision_t 
   if (value)
     {
       SVN_ERR(read_rep_offsets(&noderev->prop_rep, value,
-                               noderev->id, pool));
+                               noderev->id, result_pool));
     }
 
   /* Get the data location. */
@@ -816,7 +817,7 @@ svn_fs_fs__read_noderev(node_revision_t 
   if (value)
     {
       SVN_ERR(read_rep_offsets(&noderev->data_rep, value,
-                               noderev->id, pool));
+                               noderev->id, result_pool));
     }
 
   /* Get the created path. */
@@ -829,20 +830,20 @@ svn_fs_fs__read_noderev(node_revision_t 
     }
   else
     {
-      noderev->created_path = apr_pstrdup(pool, value);
+      noderev->created_path = apr_pstrdup(result_pool, value);
     }
 
   /* Get the predecessor ID. */
   value = svn_hash_gets(headers, HEADER_PRED);
   if (value)
     noderev->predecessor_id = svn_fs_fs__id_parse(value, strlen(value),
-                                                  pool);
+                                                  result_pool);
 
   /* Get the copyroot. */
   value = svn_hash_gets(headers, HEADER_COPYROOT);
   if (value == NULL)
     {
-      noderev->copyroot_path = apr_pstrdup(pool, noderev->created_path);
+      noderev->copyroot_path = apr_pstrdup(result_pool, noderev->created_path);
       noderev->copyroot_rev = svn_fs_fs__id_rev(noderev->id);
     }
   else
@@ -861,7 +862,7 @@ svn_fs_fs__read_noderev(node_revision_t 
         return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
                                  _("Malformed copyroot line in node-rev '%s'"),
                                  noderev_id);
-      noderev->copyroot_path = apr_pstrdup(pool, value);
+      noderev->copyroot_path = apr_pstrdup(result_pool, value);
     }
 
   /* Get the copyfrom. */
@@ -885,7 +886,7 @@ svn_fs_fs__read_noderev(node_revision_t 
         return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
                                  _("Malformed copyfrom line in node-rev '%s'"),
                                  noderev_id);
-      noderev->copyfrom_path = apr_pstrdup(pool, value);
+      noderev->copyfrom_path = apr_pstrdup(result_pool, value);
     }
 
   /* Get whether this is a fresh txn root. */

Modified: subversion/trunk/subversion/libsvn_fs_fs/low_level.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/low_level.h?rev=1604836&r1=1604835&r2=1604836&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/low_level.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/low_level.h Mon Jun 23 15:04:59 2014
@@ -118,11 +118,12 @@ svn_fs_fs__write_changes(svn_stream_t *s
                          apr_pool_t *pool);
 
 /* Read a node-revision from STREAM. Set *NODEREV to the new structure,
-   allocated in POOL. */
+   allocated in RESULT_POOL. */
 svn_error_t *
 svn_fs_fs__read_noderev(node_revision_t **noderev,
                         svn_stream_t *stream,
-                        apr_pool_t *pool);
+                        apr_pool_t *result_pool,
+                        apr_pool_t *scratch_pool);
 
 /* Write the node-revision NODEREV into the stream OUTFILE, compatible with
    filesystem format FORMAT.  Only write mergeinfo-related metadata if

Modified: subversion/trunk/subversion/libsvn_fs_fs/pack.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/pack.c?rev=1604836&r1=1604835&r2=1604836&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/pack.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/pack.c Mon Jun 23 15:04:59 2014
@@ -716,7 +716,7 @@ copy_node_to_temp(pack_context_t *contex
 
   /* read & parse noderev */
   stream = svn_stream_from_aprfile2(rev_file, TRUE, pool);
-  SVN_ERR(svn_fs_fs__read_noderev(&noderev, stream, pool));
+  SVN_ERR(svn_fs_fs__read_noderev(&noderev, stream, pool, pool));
   svn_stream_close(stream);
 
   /* create a copy of ENTRY, make it point to the copy destination and

Modified: subversion/trunk/subversion/libsvn_fs_fs/recovery.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/recovery.c?rev=1604836&r1=1604835&r2=1604836&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/recovery.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/recovery.c Mon Jun 23 15:04:59 2014
@@ -161,7 +161,7 @@ recover_find_max_ids(svn_fs_t *fs,
 
   baton.stream = rev_file->stream;
   SVN_ERR(svn_io_file_seek(rev_file->file, APR_SET, &offset, pool));
-  SVN_ERR(svn_fs_fs__read_noderev(&noderev, baton.stream, pool));
+  SVN_ERR(svn_fs_fs__read_noderev(&noderev, baton.stream, pool, pool));
 
   /* Check that this is a directory.  It should be. */
   if (noderev->kind != svn_node_dir)

Modified: subversion/trunk/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/transaction.c?rev=1604836&r1=1604835&r2=1604836&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/transaction.c Mon Jun 23 15:04:59 2014
@@ -1088,7 +1088,7 @@ svn_fs_fs__create_txn(svn_fs_txn_t **txn
   *txn_p = txn;
 
   /* Create a new root node for this transaction. */
-  SVN_ERR(svn_fs_fs__rev_get_root(&root_id, fs, rev, pool));
+  SVN_ERR(svn_fs_fs__rev_get_root(&root_id, fs, rev, pool, pool));
   SVN_ERR(create_new_txn_noderev_from_rev(fs, &ftd->txn_id, root_id, pool));
 
   /* Create an empty rev file. */
@@ -3408,7 +3408,7 @@ upgrade_transaction(svn_fs_t *fs,
                                APR_OS_DEFAULT,
                                iterpool));
       stream = svn_stream_from_aprfile2(file, TRUE, iterpool);
-      SVN_ERR(svn_fs_fs__read_noderev(&noderev, stream, iterpool));
+      SVN_ERR(svn_fs_fs__read_noderev(&noderev, stream, iterpool, iterpool));
       if (   noderev->data_rep == NULL
           || noderev->data_rep->revision != SVN_INVALID_REVNUM
           || noderev->kind != svn_node_file)



Mime
View raw message