Author: stefan2
Date: Thu Jul 25 13:53:10 2013
New Revision: 1506970

URL: http://svn.apache.org/r1506970
Log:
On the fsfs-improvments branch:  Make sure we can always represent the
full file size / offset range that SVN permits - even if the current
system would not allow us to access it.

* subversion/libsvn_fs_fs/fs.h
  (representation_t): use the full value range for offsets as well

* subversion/libsvn_fs_fs/transaction.c
  (write_hash_rep,
   write_hash_delta_rep): use local variables for offsets to get
                          matching types

Modified:
    subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs.h
    subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c

Modified: subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs.h?rev=1506970&r1=1506969&r2=1506970&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs.h 
(original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs.h Thu Jul 
25 13:53:10 2013
@@ -447,7 +447,7 @@ typedef struct representation_t
   svn_revnum_t revision;
 
   /* Offset into the revision file where it is located. */
-  apr_off_t offset;
+  svn_filesize_t offset;
 
   /* The size of the representation in bytes as seen in the revision
      file. */

Modified: 
subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c?rev=1506970&r1=1506969&r2=1506970&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c 
(original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c 
Thu Jul 25 13:53:10 2013
@@ -2199,8 +2199,9 @@ write_hash_rep(representation_t *rep,
   svn_stream_t *stream;
   struct write_hash_baton *whb;
   representation_t *old_rep;
+  apr_off_t offset = 0;
 
-  SVN_ERR(svn_fs_fs__get_file_offset(&rep->offset, file, pool));
+  SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, pool));
 
   whb = apr_pcalloc(pool, sizeof(*whb));
 
@@ -2226,7 +2227,7 @@ write_hash_rep(representation_t *rep,
   if (old_rep)
     {
       /* We need to erase from the protorev the data we just wrote. */
-      SVN_ERR(svn_io_file_trunc(file, rep->offset, pool));
+      SVN_ERR(svn_io_file_trunc(file, offset, pool));
 
       /* Use the old rep for this content. */
       memcpy(rep, old_rep, sizeof (*rep));
@@ -2236,6 +2237,8 @@ write_hash_rep(representation_t *rep,
       /* Write out our cosmetic end marker. */
       SVN_ERR(svn_stream_puts(whb->stream, "ENDREP\n"));
 
+      rep->offset = offset;
+
       /* update the representation */
       rep->size = whb->size;
       rep->expanded_size = 0;
@@ -2274,6 +2277,7 @@ write_hash_delta_rep(representation_t *r
 
   apr_off_t rep_end = 0;
   apr_off_t delta_start = 0;
+  apr_off_t offset = 0;
 
   struct write_hash_baton *whb;
   fs_fs_data_t *ffd = fs->fsap_data;
@@ -2283,7 +2287,7 @@ write_hash_delta_rep(representation_t *r
   SVN_ERR(choose_delta_base(&base_rep, fs, noderev, props, pool));
   SVN_ERR(svn_fs_fs__get_contents(&source, fs, base_rep, pool));
 
-  SVN_ERR(svn_fs_fs__get_file_offset(&rep->offset, file, pool));
+  SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, pool));
 
   /* Write out the rep header. */
   if (base_rep)
@@ -2333,7 +2337,7 @@ write_hash_delta_rep(representation_t *r
   if (old_rep)
     {
       /* We need to erase from the protorev the data we just wrote. */
-      SVN_ERR(svn_io_file_trunc(file, rep->offset, pool));
+      SVN_ERR(svn_io_file_trunc(file, offset, pool));
 
       /* Use the old rep for this content. */
       memcpy(rep, old_rep, sizeof (*rep));
@@ -2344,6 +2348,8 @@ write_hash_delta_rep(representation_t *r
       SVN_ERR(svn_fs_fs__get_file_offset(&rep_end, file, pool));
       SVN_ERR(svn_stream_puts(file_stream, "ENDREP\n"));
 
+      rep->offset = offset;
+
       /* update the representation */
       rep->expanded_size = whb->size;
       rep->size = rep_end - delta_start;


Reply via email to