]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: work around bluestore fragmetned buffers in get_map_bl
authorSage Weil <sage@redhat.com>
Tue, 23 May 2017 21:07:17 +0000 (17:07 -0400)
committerSage Weil <sage@redhat.com>
Fri, 2 Jun 2017 17:02:52 +0000 (13:02 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc

index 92f0d1f11fc8553fa399d775b5d304e2b9fa475c..d8701169ba9f5d08547ec6a3fa46359bbf1985b5 100644 (file)
@@ -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);
 }