]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ObjectCacher: begin at the right place when iterating over BufferHeads
authorJosh Durgin <josh.durgin@inktank.com>
Thu, 15 Nov 2012 18:41:32 +0000 (10:41 -0800)
committerJosh Durgin <josh.durgin@inktank.com>
Fri, 16 Nov 2012 23:22:38 +0000 (15:22 -0800)
If the desired offset overlaps a BH, data.lower_bound() will return
the element after it, since it's indexed by the start of a range.

The confusingly similarly named data_lower_bound() method fixes this,
and returns the correct starting element.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
src/osdc/ObjectCacher.cc

index c3e83c32e6c6faaaefd393261f94f2cd2f89d550..95a62ec2b10a163a853d6ee398e4a1aebd0c0530 100644 (file)
@@ -654,7 +654,7 @@ void ObjectCacher::bh_read_finish(int64_t poolid, sobject_t oid, loff_t start,
     // apply to bh's!
     loff_t opos = start;
     while (true) {
-      map<loff_t, BufferHead*>::iterator p = ob->data.lower_bound(opos);
+      map<loff_t, BufferHead*>::iterator p = ob->data_lower_bound(opos);
       if (p == ob->data.end())
        break;
       if (opos >= start+(loff_t)length) {
@@ -788,7 +788,7 @@ void ObjectCacher::bh_write_commit(int64_t poolid, sobject_t oid, loff_t start,
     }
 
     // apply to bh's!
-    for (map<loff_t, BufferHead*>::iterator p = ob->data.lower_bound(start);
+    for (map<loff_t, BufferHead*>::iterator p = ob->data_lower_bound(start);
          p != ob->data.end();
          p++) {
       BufferHead *bh = p->second;