From: Sage Weil Date: Tue, 11 Jun 2019 21:33:19 +0000 (-0500) Subject: osd/PrimaryLogPG: change fabrication of promoted clone snaps X-Git-Tag: v15.1.0~2308^2~55 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a362fedc81ab5ae76149397b2b1544206568ea9f;p=ceph.git 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 --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 4a6073b85b01..963042e1c62a 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); + } } }