From: Jianpeng Ma Date: Tue, 20 Jun 2017 20:42:02 +0000 (+0800) Subject: os/bluestore/BlueFS: replace claim_append with claim_append_piecewise to reduce memor... X-Git-Tag: v12.1.0~34^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=717809fafc49c6315046b841809d26d76107d215;p=ceph.git os/bluestore/BlueFS: replace claim_append with claim_append_piecewise to reduce memory copy. Signed-off-by: Jianpeng Ma --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index df77b87443c..f73e27cf603 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -1554,7 +1554,7 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length) dout(20) << __func__ << " using partial tail 0x" << std::hex << partial << std::dec << dendl; assert(h->tail_block.length() == partial); - bl.claim_append(h->tail_block); + bl.claim_append_piecewise(h->tail_block); x_off -= partial; offset -= partial; length += partial; @@ -1566,11 +1566,11 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length) } } if (length == partial + h->buffer.length()) { - bl.claim_append(h->buffer); + bl.claim_append_piecewise(h->buffer); } else { bufferlist t; - t.substr_of(h->buffer, 0, length); - bl.claim_append(t); + h->buffer.splice(0, length, &t); + bl.claim_append_piecewise(t); t.substr_of(h->buffer, length, h->buffer.length() - length); h->buffer.swap(t); dout(20) << " leaving 0x" << std::hex << h->buffer.length() << std::dec