librbd: flatten operation should use object map

If the object is known to exist in the image, the copy-up operation
can be skipped for that object.

Fixes: http://tracker.ceph.com/issues/23445
Signed-off-by: Mykola Golub <mgolub@suse.com>
This commit is contained in:
Mykola Golub 2018-09-05 20:24:00 +03:00
parent 4c86bccf07
commit 40af4f87b6

View File

@ -40,6 +40,15 @@ public:
return -ERESTART;
}
{
RWLock::RLocker snap_lock(image_ctx.snap_lock);
if (image_ctx.object_map != nullptr &&
!image_ctx.object_map->object_may_not_exist(m_object_no)) {
// can skip because the object already exists
return 1;
}
}
bufferlist bl;
string oid = image_ctx.get_object_name(m_object_no);
auto req = new io::ObjectWriteRequest<I>(&image_ctx, oid, m_object_no, 0,