]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Journaler: make try_read_entry store data in contiguous memory 25275/head
authorYan, Zheng <zyan@redhat.com>
Tue, 27 Nov 2018 08:15:21 +0000 (16:15 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 27 Nov 2018 08:24:46 +0000 (16:24 +0800)
If bufferlist consists of discontiguous memory, decoding types whose
denc_traits needs contiguous memory is inefficient. The bufferlist may
get copied to temporary memory multiple times. (copy_shallow() in
src/include/denc.h actually does deep copy)

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Fixes: http://tracker.ceph.com/issues/37399
src/osdc/Journaler.cc

index a464d0fd75b5c6f3f4ea4cf3ec8f4e74ea959148..8eac98eebc74c5d4f12360066270552af8cdfd4a 100644 (file)
@@ -1263,6 +1263,13 @@ bool Journaler::try_read_entry(bufferlist& bl)
 
   // prefetch?
   _prefetch();
+
+  // If bufferlist consists of discontiguous memory, decoding types whose
+  // denc_traits needs contiguous memory is inefficient. The bufferlist may
+  // get copied to temporary memory multiple times (copy_shallow() in
+  // src/include/denc.h actually does deep copy)
+  if (bl.get_num_buffers() > 1)
+    bl.rebuild();
   return true;
 }