]> git.apps.os.sepia.ceph.com Git - ceph-ci.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)
committerJason Dillaman <dillaman@redhat.com>
Thu, 23 Apr 2020 17:19:49 +0000 (13:19 -0400)
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>
src/cls/rbd/cls_rbd_types.cc
src/cls/rbd/cls_rbd_types.h

index 4da8a28246a2519c1e39fc79851e8d49970a6937..cf36de94805ac5737ba03a682006dc3df2d277e9 100644 (file)
@@ -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<void> {
index f5abbc9eb669c16695c9ef52371b90b3c957934c..d244592f2595155de0941590e07bb338fb11d53d 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;