]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
common/buffer: add function bufferlist::claim_append_piecewise(list& bl).
authorJianpeng Ma <jianpeng.ma@intel.com>
Tue, 20 Jun 2017 23:04:51 +0000 (07:04 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Tue, 20 Jun 2017 23:04:51 +0000 (07:04 +0800)
commit434656c6106479705a5e71db8843b4a272d13b88
treeaada353534fc368f486c140ed1a757e86dac2c36
parentf337b4e75ffe78fade30ccfea0b2a5758424b91a
common/buffer: add function  bufferlist::claim_append_piecewise(list&  bl).

This only useful for bl is bufferlist::page_aligned_appender. Using
this function can remove memcopy for continue ptrs.
Because page_aligned_appender::flush will split a ptr into two or
more ptrs. For this case, rebuild_aligned_size_and_memory can't handle,
it  will rebuild.

For example
a=bl.get_page_aligned_appender(1);
a.append(3K)
a.flush();
t.claim_append(bl);
a.append(1K);
a.flush();
t.claim_append(bl);

dst.claim_append(t);
//3K and 1K ptr are continue in memory. But they are two ptrs..
dst.is_aligned_size_and_memory(4096,4096) is false.

We add new function claim_append_piecewise() to specially
handle this case.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/common/buffer.cc
src/include/buffer.h
src/test/bufferlist.cc