]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
mutable/filenode.py: don't fetch more segments than necesasry to update the file
authorKevan Carstensen <kevan@isnotajoke.com>
Sat, 13 Aug 2011 21:00:05 +0000 (14:00 -0700)
committerKevan Carstensen <kevan@isnotajoke.com>
Sat, 13 Aug 2011 21:00:05 +0000 (14:00 -0700)
src/allmydata/mutable/filenode.py

index 1d2f2692fcd8c525cf14592edffe7e24f7392d5c..e798a58970b42ac7b633d92f1ca566b417f98bfe 100644 (file)
@@ -1114,6 +1114,9 @@ class MutableFileVersion:
         end_segment = start_segment
         if offset + data.get_size() < self.get_size():
             end_data = offset + data.get_size()
+            # The last byte we touch is the end_data'th byte, which is actually
+            # byte end_data - 1 because bytes are zero-indexed.
+            end_data -= 1
             end_segment = end_data // segsize
 
         self._start_segment = start_segment