]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Journaler: make try_read_entry store data in contiguous memory 25519/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:17 +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 939fbba2891c627385eb91075533b4708a94a790..02b826e73ef1c902a488c77f710be11c7f6e77cf 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;
 }