From: Kevan Carstensen <kevan@isnotajoke.com>
Date: Sat, 13 Aug 2011 21:00:05 +0000 (-0700)
Subject: mutable/filenode.py: don't fetch more segments than necesasry to update the file
X-Git-Tag: post-393~2
X-Git-Url: https://git.rkrishnan.org/components/%22news.html//%22?a=commitdiff_plain;h=62c72881bb20c77e170a56051c8fe6bcfba6dea0;p=tahoe-lafs%2Ftahoe-lafs.git

mutable/filenode.py: don't fetch more segments than necesasry to update the file
---

diff --git a/src/allmydata/mutable/filenode.py b/src/allmydata/mutable/filenode.py
index 1d2f2692..e798a589 100644
--- a/src/allmydata/mutable/filenode.py
+++ b/src/allmydata/mutable/filenode.py
@@ -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