]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados/snap_set_diff: set end_size only if end object exists
authorIlya Dryomov <idryomov@gmail.com>
Sat, 11 Nov 2023 13:15:49 +0000 (14:15 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 11 Dec 2023 11:44:35 +0000 (12:44 +0100)
Since commit 73f50a13109f ("rbd-mirror: use generalized deep copy for
image sync"), the only user of calc_snap_set_diff() immediately unsets
end_size otherwise.

calc_snap_set_diff() semantics are clearer if end_size is set together
with end_exists and clone_end_snap_id.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit c0747922040841c371dbe2706354c08c73d8e59f)

src/librados/snap_set_diff.cc
src/librbd/io/ObjectRequest.cc

index b42ad9bcd5519ebd91b1b47a097adf38b8bdc27d..c5159195f464e2eafa8438e38b0d5649548d94d3 100644 (file)
@@ -75,7 +75,6 @@ void calc_snap_set_diff(CephContext *cct, const librados::snap_set_t& snap_set,
       saw_start = true;
     }
 
-    *end_size = r->size;
     if (end < a) {
       ldout(cct, 20) << " past end " << end << ", end object does not exist" << dendl;
       *end_exists = false;
@@ -87,6 +86,7 @@ void calc_snap_set_diff(CephContext *cct, const librados::snap_set_t& snap_set,
     }
     if (end <= b) {
       ldout(cct, 20) << " end" << dendl;
+      *end_size = r->size;
       *end_exists = true;
       *clone_end_snap_id = b;
       break;
index 87c3cd7dd5289acb1f4368710eda768804f0007a..b395ad687a4cc0c702ce8897add16575407d019e 100644 (file)
@@ -842,8 +842,6 @@ void ObjectListSnapsRequest<I>::handle_list_snaps(int r) {
       diff.insert(0, image_ctx->layout.object_size);
       end_size = image_ctx->layout.object_size;
       clone_end_snap_id = end_snap_id;
-    } else if (!exists) {
-      end_size = 0;
     }
 
     if (exists) {