subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1663229 - in /subversion/branches/fsx-1.10/subversion/libsvn_fs_x: cached_data.c index.c pack.c rev_file.c rev_file.h verify.c
Date Mon, 02 Mar 2015 09:38:38 GMT
Author: stefan2
Date: Mon Mar  2 09:38:38 2015
New Revision: 1663229

URL: http://svn.apache.org/r1663229
Log:
On the fsx-1.10 branch:
Update the svn_fs_x__revision_file_t interface definition and documentation
to match the intend.

* subversion/libsvn_fs_x/rev_file.h
  (): Update the global docstring.
  (svn_fs_x__rev_file_open): Rename to ...
  (svn_fs_x__rev_file_init): ... this because we won't actually open the
                             file just then.  Drop unused SCRATCH_POOL.
  (svn_fs_x__rev_file_l2p_index,
   svn_fs_x__rev_file_p2l_index,
   svn_fs_x__close_revision_file): Update docstrings.

* subversion/libsvn_fs_x/rev_file.c
  (svn_fs_x__rev_file_open): Rename to ...
  (svn_fs_x__rev_file_init): ... this and update signature.

* subversion/libsvn_fs_x/cached_data.c
  (open_and_seek_revision,
   get_node_revision_body,
   svn_fs_x__get_mergeinfo_count,
   auto_open_shared_file,
   svn_fs_x__check_rep,
   svn_fs_x__get_changes): Update callers.

* subversion/libsvn_fs_x/index.c
  (svn_fs_x__l2p_get_max_ids): Same.

* subversion/libsvn_fs_x/pack.c
  (pack_range,
   append_revision): Same.

* subversion/libsvn_fs_x/verify.c
  (verify_index_checksums,
   compare_l2p_to_p2l_index,
   compare_p2l_to_l2p_index,
   compare_p2l_to_rev): Same.

Modified:
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/cached_data.c
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/index.c
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/pack.c
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/rev_file.c
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/rev_file.h
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/verify.c

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/cached_data.c?rev=1663229&r1=1663228&r2=1663229&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/cached_data.c Mon Mar  2 09:38:38
2015
@@ -192,8 +192,7 @@ open_and_seek_revision(svn_fs_x__revisio
 
   SVN_ERR(svn_fs_x__ensure_revision_exists(rev, fs, scratch_pool));
 
-  SVN_ERR(svn_fs_x__rev_file_open(&rev_file, fs, rev, result_pool,
-                                  scratch_pool));
+  SVN_ERR(svn_fs_x__rev_file_init(&rev_file, fs, rev, result_pool));
   SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, rev_file, id,
                                 scratch_pool));
   SVN_ERR(svn_fs_x__rev_file_seek(rev_file, NULL, offset));
@@ -313,8 +312,8 @@ get_node_revision_body(svn_fs_x__noderev
       svn_revnum_t revision = svn_fs_x__get_revnum(id->change_set);
       svn_fs_x__pair_cache_key_t key;
 
-      SVN_ERR(svn_fs_x__rev_file_open(&revision_file, fs, revision,
-                                      scratch_pool, scratch_pool));
+      SVN_ERR(svn_fs_x__rev_file_init(&revision_file, fs, revision,
+                                      scratch_pool));
 
       /* First, try a noderevs container cache lookup. */
       if (   svn_fs_x__is_packed_rev(fs, revision)
@@ -408,8 +407,8 @@ svn_fs_x__get_mergeinfo_count(apr_int64_
       svn_revnum_t revision = svn_fs_x__get_revnum(id->change_set);
 
       svn_fs_x__revision_file_t *rev_file;
-      SVN_ERR(svn_fs_x__rev_file_open(&rev_file, fs, revision,
-                                      scratch_pool, scratch_pool));
+      SVN_ERR(svn_fs_x__rev_file_init(&rev_file, fs, revision,
+                                      scratch_pool));
 
       if (   svn_fs_x__is_packed_rev(fs, revision)
           && ffd->noderevs_container_cache)
@@ -495,9 +494,8 @@ static svn_error_t*
 auto_open_shared_file(shared_file_t *file)
 {
   if (file->rfile == NULL)
-    SVN_ERR(svn_fs_x__rev_file_open(&file->rfile, file->fs,
-                                    file->revision, file->pool,
-                                    file->pool));
+    SVN_ERR(svn_fs_x__rev_file_init(&file->rfile, file->fs,
+                                    file->revision, file->pool));
 
   return SVN_NO_ERROR;
 }
@@ -782,8 +780,7 @@ svn_fs_x__check_rep(svn_fs_x__representa
   svn_revnum_t revision = svn_fs_x__get_revnum(rep->id.change_set);
 
   svn_fs_x__revision_file_t *rev_file;
-  SVN_ERR(svn_fs_x__rev_file_open(&rev_file, fs, revision,
-                                  scratch_pool, scratch_pool));
+  SVN_ERR(svn_fs_x__rev_file_init(&rev_file, fs, revision, scratch_pool));
 
   /* Does REP->ID refer to an actual item? Which one is it? */
   SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, rev_file, &rep->id,
@@ -2797,8 +2794,7 @@ svn_fs_x__get_changes(apr_array_header_t
   /* Provide revision file. */
 
   SVN_ERR(svn_fs_x__ensure_revision_exists(rev, fs, scratch_pool));
-  SVN_ERR(svn_fs_x__rev_file_open(&revision_file, fs, rev,
-                                  scratch_pool, scratch_pool));
+  SVN_ERR(svn_fs_x__rev_file_init(&revision_file, fs, rev, scratch_pool));
 
   /* try cache lookup first */
 

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/index.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/index.c?rev=1663229&r1=1663228&r2=1663229&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/index.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/index.c Mon Mar  2 09:38:38 2015
@@ -1912,8 +1912,7 @@ svn_fs_x__l2p_get_max_ids(apr_array_head
   apr_pool_t *header_pool = svn_pool_create(scratch_pool);
 
   /* read index master data structure for the index covering START_REV */
-  SVN_ERR(svn_fs_x__rev_file_open(&rev_file, fs, start_rev,
-                                  header_pool, header_pool));
+  SVN_ERR(svn_fs_x__rev_file_init(&rev_file, fs, start_rev, header_pool));
   SVN_ERR(get_l2p_header(&header, rev_file, fs, start_rev, header_pool,
                          header_pool));
   SVN_ERR(svn_fs_x__close_revision_file(rev_file));
@@ -1934,8 +1933,8 @@ svn_fs_x__l2p_get_max_ids(apr_array_head
            * the number of items in a revision, i.e. there is no consistency
            * issue here. */
           svn_pool_clear(header_pool);
-          SVN_ERR(svn_fs_x__rev_file_open(&rev_file, fs, revision,
-                                          header_pool, header_pool));
+          SVN_ERR(svn_fs_x__rev_file_init(&rev_file, fs, revision,
+                                          header_pool));
           SVN_ERR(get_l2p_header(&header, rev_file, fs, revision,
                                  header_pool, header_pool));
           SVN_ERR(svn_fs_x__close_revision_file(rev_file));

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/pack.c?rev=1663229&r1=1663228&r2=1663229&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/pack.c Mon Mar  2 09:38:38 2015
@@ -1733,8 +1733,8 @@ pack_range(pack_context_t *context,
       svn_fs_x__index_info_t l2p_index_info;
 
       /* Get the rev file dimensions (mainly index locations). */
-      SVN_ERR(svn_fs_x__rev_file_open(&rev_file, context->fs, revision,
-                                      revpool, iterpool));
+      SVN_ERR(svn_fs_x__rev_file_init(&rev_file, context->fs, revision,
+                                      revpool));
       SVN_ERR(svn_fs_x__rev_file_l2p_info(&l2p_index_info, rev_file));
 
       /* store the indirect array index */
@@ -1861,8 +1861,8 @@ append_revision(pack_context_t *context,
   SVN_ERR(svn_io_stat(&finfo, path, APR_FINFO_SIZE, scratch_pool));
 
   /* Copy all the bits from the rev file to the end of the pack file. */
-  SVN_ERR(svn_fs_x__rev_file_open(&rev_file, context->fs, context->start_rev,
-                                  scratch_pool, iterpool));
+  SVN_ERR(svn_fs_x__rev_file_init(&rev_file, context->fs, context->start_rev,
+                                  scratch_pool));
   SVN_ERR(svn_fs_x__rev_file_get(&file, rev_file));
   SVN_ERR(copy_file_data(context, context->pack_file, file, finfo.size,
                          iterpool));

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/rev_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/rev_file.c?rev=1663229&r1=1663228&r2=1663229&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/rev_file.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/rev_file.c Mon Mar  2 09:38:38 2015
@@ -246,11 +246,10 @@ open_pack_or_rev_file(svn_fs_x__revision
 }
 
 svn_error_t *
-svn_fs_x__rev_file_open(svn_fs_x__revision_file_t **file,
+svn_fs_x__rev_file_init(svn_fs_x__revision_file_t **file,
                         svn_fs_t *fs,
                         svn_revnum_t rev,
-                        apr_pool_t *result_pool,
-                        apr_pool_t *scratch_pool)
+                        apr_pool_t *result_pool)
 {
   *file = init_revision_file(fs, rev, result_pool);
   return SVN_NO_ERROR;

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/rev_file.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/rev_file.h?rev=1663229&r1=1663228&r2=1663229&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/rev_file.h (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/rev_file.h Mon Mar  2 09:38:38 2015
@@ -26,11 +26,14 @@
 #include "svn_fs.h"
 #include "id.h"
 
-/* In format 7, index files must be read in sync with the respective
- * revision / pack file.  I.e. we must use packed index files for packed
- * rev files and unpacked ones for non-packed rev files.  So, the whole
- * point is to open them with matching "is packed" setting in case some
- * background pack process was run.
+/* In FSX, index data must be read in sync with the respective revision /
+ * pack file.  I.e. we must use packed index files for packed rev files and
+ * unpacked ones for non-packed rev files.  So, the whole point is to open
+ * them with matching "is packed" setting in case some background pack
+ * process was run.
+ *
+ * Another thing that this allows us is to lazily open the file, i.e. open
+ * it upon first access.
  */
 
 /* Opaque index stream type.
@@ -70,17 +73,16 @@ typedef struct svn_fs_x__rev_file_info_t
  */
 typedef struct svn_fs_x__revision_file_t svn_fs_x__revision_file_t;
 
-/* Open the correct revision file for REV.  If the filesystem FS has
- * been packed, *FILE will be set to the packed file; otherwise, set *FILE
- * to the revision file for REV.  Return SVN_ERR_FS_NO_SUCH_REVISION if the
- * file doesn't exist.  Allocate *FILE in RESULT_POOL and use SCRATCH_POOL
- * for temporaries. */
+/* Initialize the revision / pack file access structure in *FILE for reading
+ * revision REV from filesystem FS.  The file will not be opened until the
+ * first call to any of the access functions.
+ *
+ * Allocate *FILE in RESULT_POOL. */
 svn_error_t *
-svn_fs_x__rev_file_open(svn_fs_x__revision_file_t **file,
+svn_fs_x__rev_file_init(svn_fs_x__revision_file_t **file,
                         svn_fs_t *fs,
                         svn_revnum_t rev,
-                        apr_pool_t *result_pool,
-                        apr_pool_t *scratch_pool);
+                        apr_pool_t *result_pool);
 
 /* Open the correct revision file for REV with read and write access.
  * If necessary, temporarily reset the file's read-only state.  If the
@@ -140,15 +142,13 @@ svn_error_t *
 svn_fs_x__rev_file_get(apr_file_t **apr_file,
                        svn_fs_x__revision_file_t *file);
 
-/* Set *STREAM to the shared L2P data stream of FILE.  Initializes the
- * stream on demand.
+/* Set *STREAM to the shared L2P data stream of FILE.
  */
 svn_error_t *
 svn_fs_x__rev_file_l2p_index(svn_fs_x__packed_number_stream_t **stream,
                              svn_fs_x__revision_file_t *file);
 
-/* Set *STREAM to the shared P2L data stream of FILE.  Initializes the
- * stream on demand.
+/* Set *STREAM to the shared P2L data stream of FILE.
  */
 svn_error_t *
 svn_fs_x__rev_file_p2l_index(svn_fs_x__packed_number_stream_t **stream,
@@ -185,7 +185,8 @@ svn_fs_x__rev_file_read(svn_fs_x__revisi
                         void *buf,
                         apr_size_t nbytes);
 
-/* Close all files and streams in FILE.
+/* Close all files and streams in FILE.  They will be reopened automatically
+ * by any of the above access functions.
  */
 svn_error_t *
 svn_fs_x__close_revision_file(svn_fs_x__revision_file_t *file);

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/verify.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/verify.c?rev=1663229&r1=1663228&r2=1663229&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/verify.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/verify.c Mon Mar  2 09:38:38 2015
@@ -203,8 +203,7 @@ verify_index_checksums(svn_fs_t *fs,
   svn_fs_x__index_info_t p2l_index_info;
 
   /* Open the rev / pack file and read the footer */
-  SVN_ERR(svn_fs_x__rev_file_open(&rev_file, fs, start,
-                                  scratch_pool, scratch_pool));
+  SVN_ERR(svn_fs_x__rev_file_init(&rev_file, fs, start, scratch_pool));
   SVN_ERR(svn_fs_x__rev_file_l2p_info(&l2p_index_info, rev_file));
   SVN_ERR(svn_fs_x__rev_file_p2l_info(&p2l_index_info, rev_file));
 
@@ -239,8 +238,7 @@ compare_l2p_to_p2l_index(svn_fs_t *fs,
 
   /* common file access structure */
   svn_fs_x__revision_file_t *rev_file;
-  SVN_ERR(svn_fs_x__rev_file_open(&rev_file, fs, start, scratch_pool,
-                                  iterpool));
+  SVN_ERR(svn_fs_x__rev_file_init(&rev_file, fs, start, scratch_pool));
 
   /* determine the range of items to check for each revision */
   SVN_ERR(svn_fs_x__l2p_get_max_ids(&max_ids, fs, start, count, scratch_pool,
@@ -331,8 +329,7 @@ compare_p2l_to_l2p_index(svn_fs_t *fs,
 
   /* common file access structure */
   svn_fs_x__revision_file_t *rev_file;
-  SVN_ERR(svn_fs_x__rev_file_open(&rev_file, fs, start, scratch_pool,
-                                  iterpool));
+  SVN_ERR(svn_fs_x__rev_file_init(&rev_file, fs, start, scratch_pool));
 
   /* get the size of the rev / pack file as covered by the P2L index */
   SVN_ERR(svn_fs_x__p2l_get_max_offset(&max_offset, fs, rev_file, start,
@@ -584,8 +581,7 @@ compare_p2l_to_rev(svn_fs_t *fs,
   svn_fs_x__index_info_t l2p_index_info;
 
   /* open the pack / rev file that is covered by the p2l index */
-  SVN_ERR(svn_fs_x__rev_file_open(&rev_file, fs, start, scratch_pool,
-                                  iterpool));
+  SVN_ERR(svn_fs_x__rev_file_init(&rev_file, fs, start, scratch_pool));
 
   /* check file size vs. range covered by index */
   SVN_ERR(svn_fs_x__rev_file_l2p_info(&l2p_index_info, rev_file));



Mime
View raw message