]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/rbd: added clean_since_snap_id to MirrorSnapshotNamespace
authorJason Dillaman <dillaman@redhat.com>
Tue, 21 Apr 2020 15:07:30 +0000 (11:07 -0400)
committerNathan Cutler <ncutler@suse.com>
Wed, 29 Apr 2020 12:06:58 +0000 (14:06 +0200)
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 <dillaman@redhat.com>
(cherry picked from commit 50702eece0b1d7535d387bdf923b88cd4bbfee37)

src/cls/rbd/cls_rbd_types.cc
src/cls/rbd/cls_rbd_types.h

index 9071f3457fe5d8d6d1a6ad262a07624f0e3895b7..5f3c40b049f2f312a8d6b6696ef295b88958be70 100644 (file)
@@ -767,10 +767,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<void> {
index b2c155eb864a2378101b2e27addd94c742efce73..5ea37caf7d45ceaa93dd3b3b974fc7d84e9d7dde 100644 (file)
@@ -545,7 +545,10 @@ struct MirrorSnapshotNamespace {
   std::set<std::string> 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;