]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: flatten operation should use object map 23941/head
authorMykola Golub <mgolub@suse.com>
Wed, 5 Sep 2018 17:24:00 +0000 (20:24 +0300)
committerMykola Golub <mgolub@suse.com>
Mon, 10 Sep 2018 13:14:03 +0000 (16:14 +0300)
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>
src/librbd/operation/FlattenRequest.cc

index 071cbe43d1741d41346464430771b913e25893d4..0b861ebe59d01055b6fcb6e8e5612cd5dfdd9315 100644 (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,