From: Jason Dillaman Date: Tue, 21 Apr 2020 15:07:30 +0000 (-0400) Subject: cls/rbd: added clean_since_snap_id to MirrorSnapshotNamespace X-Git-Tag: wip-pdonnell-testing-20200918.022351~1442^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=50702eece0b1d7535d387bdf923b88cd4bbfee37;p=ceph-ci.git cls/rbd: added clean_since_snap_id to MirrorSnapshotNamespace It is only valid for primary snapshots so we can re-use the space previously used by the primary_snap_id without the need to bump the version id. Signed-off-by: Jason Dillaman --- diff --git a/src/cls/rbd/cls_rbd_types.cc b/src/cls/rbd/cls_rbd_types.cc index 4da8a28246a..cf36de94805 100644 --- a/src/cls/rbd/cls_rbd_types.cc +++ b/src/cls/rbd/cls_rbd_types.cc @@ -774,10 +774,14 @@ void MirrorSnapshotNamespace::dump(Formatter *f) const { f->dump_string("mirror_peer_uuid", peer); } f->close_section(); - f->dump_string("primary_mirror_uuid", primary_mirror_uuid); - f->dump_unsigned("primary_snap_id", primary_snap_id); - f->dump_unsigned("last_copied_object_number", last_copied_object_number); - f->dump_stream("snap_seqs") << snap_seqs; + if (is_primary()) { + f->dump_unsigned("clean_since_snap_id", clean_since_snap_id); + } else { + f->dump_string("primary_mirror_uuid", primary_mirror_uuid); + f->dump_unsigned("primary_snap_id", primary_snap_id); + f->dump_unsigned("last_copied_object_number", last_copied_object_number); + f->dump_stream("snap_seqs") << snap_seqs; + } } class EncodeSnapshotNamespaceVisitor : public boost::static_visitor { diff --git a/src/cls/rbd/cls_rbd_types.h b/src/cls/rbd/cls_rbd_types.h index f5abbc9eb66..d244592f259 100644 --- a/src/cls/rbd/cls_rbd_types.h +++ b/src/cls/rbd/cls_rbd_types.h @@ -545,7 +545,10 @@ struct MirrorSnapshotNamespace { std::set mirror_peer_uuids; std::string primary_mirror_uuid; - snapid_t primary_snap_id = CEPH_NOSNAP; + union { + snapid_t primary_snap_id = CEPH_NOSNAP; + snapid_t clean_since_snap_id; + }; uint64_t last_copied_object_number = 0; SnapSeqs snap_seqs;