]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/PrimaryLogPG: change fabrication of promoted clone snaps
authorSage Weil <sage@redhat.com>
Tue, 11 Jun 2019 21:33:19 +0000 (16:33 -0500)
committerSage Weil <sage@redhat.com>
Tue, 2 Jul 2019 13:37:48 +0000 (08:37 -0500)
Instead of using SnapSet::snaps (which we are trying to kill), use the
clone_snaps[] snaps.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PrimaryLogPG.cc

index 4a6073b85b01a1cf485a89c058f04017eb5742c4..963042e1c62aed049a5827335c71c85350c0f910 100644 (file)
@@ -9460,18 +9460,25 @@ void PrimaryLogPG::finish_promote(int r, CopyResults *results,
 
   if (r != -ENOENT && soid.is_snap()) {
     if (results->snaps.empty()) {
-      // we must have read "snap" content from the head object in
-      // the base pool.  use snap_seq to construct what snaps should
-      // be for this clone (what is was before we evicted the clean
-      // clone from this pool, and what it will be when we flush and
-      // the clone eventually happens in the base pool).
+      // we must have read "snap" content from the head object in the
+      // base pool.  use snap_seq to construct what snaps should be
+      // for this clone (what is was before we evicted the clean clone
+      // from this pool, and what it will be when we flush and the
+      // clone eventually happens in the base pool).  we want to use
+      // snaps in (results->snap_seq,soid.snap]
       SnapSet& snapset = obc->ssc->snapset;
-      vector<snapid_t>::iterator p = snapset.snaps.begin();
-      while (p != snapset.snaps.end() && *p > soid.snap)
-       ++p;
-      while (p != snapset.snaps.end() && *p > results->snap_seq) {
-       results->snaps.push_back(*p);
-       ++p;
+      for (auto p = snapset.clone_snaps.rbegin();
+          p != snapset.clone_snaps.rend();
+          ++p) {
+       for (auto snap : p->second) {
+         if (snap > soid.snap) {
+           continue;
+         }
+         if (snap <= results->snap_seq) {
+           break;
+         }
+         results->snaps.push_back(snap);
+       }
       }
     }