Merge pull request #1575 from jdurgin/wip-librbd-cp-sparse

librbd: skip zeroes when copying an image

Reviewed-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2014-03-31 18:15:12 -07:00
commit 87b08b23c3

View File

@ -1955,6 +1955,13 @@ reprotect_and_return_err:
return;
}
assert(m_bl->length() == (size_t)r);
if (m_bl->is_zero()) {
delete m_bl;
m_throttle->end_op(r);
return;
}
Context *ctx = new C_CopyWrite(m_throttle, m_bl);
AioCompletion *comp = aio_create_completion_internal(ctx, rbd_ctx_cb);
r = aio_write(m_dest, m_offset, m_bl->length(), m_bl->c_str(), comp);