From a362fedc81ab5ae76149397b2b1544206568ea9f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 11 Jun 2019 16:33:19 -0500 Subject: [PATCH] osd/PrimaryLogPG: change fabrication of promoted clone snaps Instead of using SnapSet::snaps (which we are trying to kill), use the clone_snaps[] snaps. Signed-off-by: Sage Weil --- src/osd/PrimaryLogPG.cc | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 4a6073b85b0..963042e1c62 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -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::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); + } } } -- 2.39.5