From: Sage Weil Date: Tue, 23 May 2017 21:07:17 +0000 (-0400) Subject: osd: work around bluestore fragmetned buffers in get_map_bl X-Git-Tag: ses5-milestone6~8^2~19^2~33 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=85cc2595c7aee26cc9b2a9d3083f3a0400abcec1;p=ceph.git osd: work around bluestore fragmetned buffers in get_map_bl Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 92f0d1f11fc..d8701169ba9 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1460,8 +1460,9 @@ bool OSDService::_get_map_bl(epoch_t e, bufferlist& bl) found = store->read(coll_t::meta(), OSD::get_osdmap_pobject_name(e), 0, 0, bl, CEPH_OSD_OP_FLAG_FADVISE_WILLNEED) >= 0; - if (found) + if (found) { _add_map_bl(e, bl); + } return found; } @@ -1479,14 +1480,19 @@ bool OSDService::get_inc_map_bl(epoch_t e, bufferlist& bl) found = store->read(coll_t::meta(), OSD::get_inc_osdmap_pobject_name(e), 0, 0, bl, CEPH_OSD_OP_FLAG_FADVISE_WILLNEED) >= 0; - if (found) + if (found) { _add_map_inc_bl(e, bl); + } return found; } void OSDService::_add_map_bl(epoch_t e, bufferlist& bl) { dout(10) << "add_map_bl " << e << " " << bl.length() << " bytes" << dendl; + // cache a contiguous buffer + if (bl.get_num_buffers() > 1) { + bl.rebuild(); + } bl.try_assign_to_mempool(mempool::mempool_osd_mapbl); map_bl_cache.add(e, bl); } @@ -1494,6 +1500,10 @@ void OSDService::_add_map_bl(epoch_t e, bufferlist& bl) void OSDService::_add_map_inc_bl(epoch_t e, bufferlist& bl) { dout(10) << "add_map_inc_bl " << e << " " << bl.length() << " bytes" << dendl; + // cache a contiguous buffer + if (bl.get_num_buffers() > 1) { + bl.rebuild(); + } bl.try_assign_to_mempool(mempool::mempool_osd_mapbl); map_bl_inc_cache.add(e, bl); } @@ -1501,12 +1511,20 @@ void OSDService::_add_map_inc_bl(epoch_t e, bufferlist& bl) void OSDService::pin_map_inc_bl(epoch_t e, bufferlist &bl) { Mutex::Locker l(map_cache_lock); + // cache a contiguous buffer + if (bl.get_num_buffers() > 1) { + bl.rebuild(); + } map_bl_inc_cache.pin(e, bl); } void OSDService::pin_map_bl(epoch_t e, bufferlist &bl) { Mutex::Locker l(map_cache_lock); + // cache a contiguous buffer + if (bl.get_num_buffers() > 1) { + bl.rebuild(); + } map_bl_cache.pin(e, bl); }