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
rbd-mirror: Add sparse read for sync image #11005
Conversation
8b6db5c
to
2561b2e
Compare
@jazeltq unit tests are failing |
@dillaman ok, i will check.... |
@@ -103,6 +103,8 @@ void ObjectCopyRequest<I>::send_read_object() { | |||
|
|||
bool read_required = false; | |||
librados::ObjectReadOperation op; | |||
std::map<uint64_t, uint64_t> extents; | |||
bufferlist xbl; |
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.
Local variable -- will be destructed before async operation completes. Update the tuple to provide storage for the extents and bufferlist.
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.
Ok. Thanks dillaman.
for(auto &it : extents){ | ||
bufferlist tmpbl; | ||
len = it.second - it.first; | ||
tmpbl.copy_in(begin, len, databl); |
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.
Use bufferlist::substr_of to quickly build a new zero-copy write bl
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.
Ok. Thanks dillaman.
2561b2e
to
c0822c6
Compare
RWLock::RLocker l(file->lock); | ||
len = clip_io(off, len, file->data.length()); | ||
|
||
if (m != NULL) { | ||
m->clear(); | ||
if (len > 0) { | ||
(*m)[off] = len; |
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.
@dillaman The sparse_read here is not right. It just put the length to the extents. How to use bufferlist to emulate sparse_read here ?
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.
For the unit tests, it's probably safe enough to just populate the entire requested extent even if it doesn't exist. This test stub doesn't track holes, so you wouldn't get a true implementation.
e60ca08
to
d476fce
Compare
ping @dillaman |
@@ -173,14 +172,19 @@ void ObjectCopyRequest<I>::send_write_object() { | |||
|
|||
auto &sync_ops = m_snap_sync_ops.begin()->second; | |||
assert(!sync_ops.empty()); | |||
|
|||
uint64_t begin; |
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.
Minor: can you use a more descriptive variable name? Perhaps something like buffer_offset
Currently, the image sync do full read, and we shall add sparse read to let the sync more efficiently. Feature: http://tracker.ceph.com/issues/16780 Signed-off-by: tianqing <tianqing@unitedstack.com>
d476fce
to
b5db8bc
Compare
ping @dillaman |
Currently, the image sync do full read, and we shall add sparse read
to let the sync more efficiently.
Feature: http://tracker.ceph.com/issues/16780
Signed-off-by: tianqing tianqing@unitedstack.com