Rev 2891: (robertc) Trivial tweak to the readv expansion logic after using it in anger. (Robert Collins) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sat Oct 6 09:10:37 BST 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2891
revision-id: pqm at pqm.ubuntu.com-20071006081035-7jsqv4bddh63ohdc
parent: pqm at pqm.ubuntu.com-20071005032619-b6c99y625rawducb
parent: robertc at robertcollins.net-20071006072506-fypnagvqddbyh4q9
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2007-10-06 09:10:35 +0100
message:
  (robertc) Trivial tweak to the readv expansion logic after using it in anger. (Robert Collins)
modified:
  bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
    ------------------------------------------------------------
    revno: 2890.1.1
    merged: robertc at robertcollins.net-20071006072506-fypnagvqddbyh4q9
    parent: pqm at pqm.ubuntu.com-20071005032619-b6c99y625rawducb
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: readv
    timestamp: Sat 2007-10-06 17:25:06 +1000
    message:
      Tweak readv read-expansion logic.
=== modified file 'bzrlib/transport/__init__.py'
--- a/bzrlib/transport/__init__.py	2007-10-04 05:09:58 +0000
+++ b/bzrlib/transport/__init__.py	2007-10-06 07:25:06 +0000
@@ -673,15 +673,18 @@
                         yield None
                 return empty_yielder()
             # expand by page size at either end
-            expansion = self.recommended_page_size()
-            reduction = expansion / 2
+            maximum_expansion = self.recommended_page_size()
             new_offsets = []
             for offset, length in offsets:
+                expansion = maximum_expansion - length
+                if expansion < 0:
+                    # we're asking for more than the minimum read anyway.
+                    expansion = 0
+                reduction = expansion / 2
                 new_offset = offset - reduction
                 new_length = length + expansion
                 if new_offset < 0:
                     # don't ask for anything < 0
-                    new_length -= new_offset
                     new_offset = 0
                 if (upper_limit is not None and
                     new_offset + new_length > upper_limit):




More information about the bazaar-commits mailing list