From: Jianpeng Ma Date: Wed, 12 Jul 2017 12:08:25 +0000 (+0800) Subject: os/bluestore/BlueStore: using bufferlist::copy avoid rebuild. X-Git-Tag: v12.1.1~12^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c02082d9d78763b00f5fb83088ee661ca28fa850;p=ceph.git os/bluestore/BlueStore: using bufferlist::copy avoid rebuild. If using bufferlist::get_contiguous, there is maybe rebuild whic cause redundat memcopy. And bufferlist::copy can do the same function. Signed-off-by: Jianpeng Ma --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 6c3cb7ceae67..a123bfd3516d 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -9289,7 +9289,7 @@ void BlueStore::_pad_zeros( bufferptr z = buffer::create_page_aligned(chunk_size); memset(z.c_str(), 0, front_pad); pad_count += front_pad; - memcpy(z.c_str() + front_pad, bl->get_contiguous(0, front_copy), front_copy); + bl->copy(0, front_copy, z.c_str() + front_pad); if (front_copy + front_pad < chunk_size) { back_pad = chunk_size - (length + front_pad); memset(z.c_str() + front_pad + length, 0, back_pad); @@ -9312,8 +9312,7 @@ void BlueStore::_pad_zeros( back_pad = chunk_size - back_copy; assert(back_copy <= length); bufferptr tail(chunk_size); - memcpy(tail.c_str(), bl->get_contiguous(length - back_copy, back_copy), - back_copy); + bl->copy(length - back_copy, back_copy, tail.c_str()); memset(tail.c_str() + back_copy, 0, back_pad); bufferlist old; old.swap(*bl);