From: Josh Durgin Date: Thu, 15 Nov 2012 18:41:32 +0000 (-0800) Subject: ObjectCacher: begin at the right place when iterating over BufferHeads X-Git-Tag: v0.55~82^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fdadefe331594741a99c70858b9b21111e4a21d6;p=ceph.git ObjectCacher: begin at the right place when iterating over BufferHeads 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 --- diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index c3e83c32e6c6..95a62ec2b10a 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -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::iterator p = ob->data.lower_bound(opos); + map::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::iterator p = ob->data.lower_bound(start); + for (map::iterator p = ob->data_lower_bound(start); p != ob->data.end(); p++) { BufferHead *bh = p->second;