]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/rbd: store primary to non-primary snap mapping in mirror snapshot
authorJason Dillaman <dillaman@redhat.com>
Wed, 5 Feb 2020 14:59:32 +0000 (09:59 -0500)
committerJason Dillaman <dillaman@redhat.com>
Thu, 13 Feb 2020 13:11:17 +0000 (08:11 -0500)
The mirror non-primary snapshot namespace already stores the copy
progress so might as well store the required snapshot mapping
table.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/cls/rbd/cls_rbd_types.cc
src/cls/rbd/cls_rbd_types.h

index 0a409828760e2b26c5b6a336877eba0348110add..e72821ccff0a70447662e8923958931d6dab23ab 100644 (file)
@@ -745,6 +745,7 @@ void MirrorNonPrimarySnapshotNamespace::encode(bufferlist& bl) const {
   encode(primary_snap_id, bl);
   encode(copied, bl);
   encode(last_copied_object_number, bl);
+  encode(snap_seqs, bl);
 }
 
 void MirrorNonPrimarySnapshotNamespace::decode(bufferlist::const_iterator& it) {
@@ -753,6 +754,7 @@ void MirrorNonPrimarySnapshotNamespace::decode(bufferlist::const_iterator& it) {
   decode(primary_snap_id, it);
   decode(copied, it);
   decode(last_copied_object_number, it);
+  decode(snap_seqs, it);
 }
 
 void MirrorNonPrimarySnapshotNamespace::dump(Formatter *f) const {
@@ -760,6 +762,7 @@ void MirrorNonPrimarySnapshotNamespace::dump(Formatter *f) const {
   f->dump_unsigned("primary_snap_id", primary_snap_id);
   f->dump_bool("copied", copied);
   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> {
@@ -985,7 +988,8 @@ std::ostream& operator<<(std::ostream& os,
      << "primary_mirror_uuid=" << ns.primary_mirror_uuid << ", "
      << "primary_snap_id=" << ns.primary_snap_id << ", "
      << "copied=" << ns.copied << ", "
-     << "last_copied_object_number=" << ns.last_copied_object_number
+     << "last_copied_object_number=" << ns.last_copied_object_number << ", "
+     << "snap_seqs=" << ns.snap_seqs
      << "]";
   return os;
 }
index 2416b8e3c1603aba8d1cbc5d18e809a377f2e93a..d4e5f2be5a42218920dd4770016747bc3bee4d83 100644 (file)
@@ -541,6 +541,8 @@ struct MirrorPrimarySnapshotNamespace {
   }
 };
 
+typedef std::map<uint64_t, uint64_t> SnapSeqs;
+
 struct MirrorNonPrimarySnapshotNamespace {
   static const SnapshotNamespaceType SNAPSHOT_NAMESPACE_TYPE =
     SNAPSHOT_NAMESPACE_TYPE_MIRROR_NON_PRIMARY;
@@ -549,6 +551,7 @@ struct MirrorNonPrimarySnapshotNamespace {
   snapid_t primary_snap_id = CEPH_NOSNAP;
   bool copied = false;
   uint64_t last_copied_object_number = 0;
+  SnapSeqs snap_seqs;
 
   MirrorNonPrimarySnapshotNamespace() {
   }