]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Journaler: make try_read_entry store data in contiguous memory 25520/head
authorYan, Zheng <zyan@redhat.com>
Tue, 27 Nov 2018 08:15:21 +0000 (16:15 +0800)
committerNathan Cutler <ncutler@suse.com>
Wed, 12 Dec 2018 21:24:53 +0000 (22:24 +0100)
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
(cherry picked from commit 39d044be3c8c29941443afd7daaf61603efec2c9)

src/osdc/Journaler.cc

index 8ca0c4b27188eddf8db2856db60ebb1fcb3bade4..79b1524a7382b8b180771b8eaeb50a07b5a5a227 100644 (file)
@@ -1267,6 +1267,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;
 }