New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buffer: use move construct to append/push_back/push_front #7455
Conversation
b73a429
to
dc15bb5
Compare
void buffer::list::append(ptr&& bp) | ||
{ | ||
if (bp.length()) | ||
push_back(bp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bp is an lvalue in the body of the function, so the call to push_back() needs to cast it again: push_back(std::move(bp));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMG, I correct my thought now....
dc15bb5
to
8a81085
Compare
done |
void push_front(ptr&& bp) { | ||
if (bp.length() == 0) | ||
return; | ||
_buffers.push_front(std::move(bp)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to call bp.length() before push_front() here. it looks like you applied this fix to void push_front(ptr& bp) {
instead
8a81085
to
364b7da
Compare
@cbodley thanks for quick comments, fixed |
@yuyuyu101 looks good to me 👍 |
364b7da
to
bc14cc2
Compare
<< dendl; | ||
bl.push_back(bp); | ||
bl.append_zero(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be
bl.append_zero(length - bl.length());
apart from #7455 (comment), lgtm might need to extract the change to bufferlist into another commit. |
bc14cc2
to
8deb697
Compare
@tchaikov thanks, done. |
lgtm with qa run. |
In file included from os/bluestore/KernelDevice.h:18:0, |
Signed-off-by: Haomai Wang <haomai@xsky.com>
7ebcb1d
to
4c17b1d
Compare
Signed-off-by: Haomai Wang <haomai@xsky.com>
Signed-off-by: Haomai Wang <haomai@xsky.com>
4c17b1d
to
669f143
Compare
@yuyuyu101 the operator= looks correct to me. i see that we have pretty good test coverage for the bufferlist constructors and operators in src/test/bufferlist.cc; could you add some test cases for the new operations? |
86b5e0f
to
f969207
Compare
Signed-off-by: Haomai Wang <haomai@xsky.com>
f969207
to
41c3dc2
Compare
@yuyuyu101 looks good, thanks! |
buffer: use move construct to append/push_back/push_front Reviewed-by: Sage Weil <sage@redhat.com>
@yuyuyu101 Running
The comparison fails on a section where there is no backing RBD object but the read operation returned a non-zeroed buffer. Here is a simple reproducer: ceph_test_librbd_fsx -d -W -R -p 100 -P ~/archive -r 1 -w 1 -t 1 -h 1 -l 250000000 -S 4621 -N 1000 pool_client.0 image_client.0 -U |
No description provided.