}
}
+/**
+ * filter trimming|trimmed snaps out of snapcontext
+ */
+void PG::filter_snapc(SnapContext& snapc)
+{
+ bool filtering = false;
+ vector<snapid_t> newsnaps;
+ for (vector<snapid_t>::iterator p = snapc.snaps.begin();
+ p != snapc.snaps.end();
+ ++p) {
+ if (snap_trimq.contains(*p) || info.purged_snaps.contains(*p)) {
+ if (!filtering) {
+ // start building a new vector with what we've seen so far
+ dout(10) << "filter_snapc filtering " << snapc << dendl;
+ newsnaps.insert(newsnaps.begin(), snapc.snaps.begin(), p);
+ filtering = true;
+ }
+ dout(20) << "filter_snapc removing trimq|purged snap " << *p << dendl;
+ } else {
+ if (filtering)
+ newsnaps.push_back(*p); // continue building new vector
+ }
+ }
+ if (filtering) {
+ snapc.snaps.swap(newsnaps);
+ dout(10) << "filter_snapc result " << snapc << dendl;
+ }
+}
+
+
void PG::adjust_local_snaps()
{
interval_set<snapid_t> to_remove;
coll_t make_snap_collection(ObjectStore::Transaction& t, snapid_t sn);
void update_snap_collections(vector<pg_log_entry_t> &log_entries,
ObjectStore::Transaction& t);
+ void filter_snapc(SnapContext& snapc);
void adjust_local_snaps();
void log_weirdness();
snapc.snaps = ctx->new_snapset.snaps;
dout(10) << " using newer snapc " << snapc << dendl;
}
+
+ if (ctx->obs->exists)
+ filter_snapc(snapc);
if (ctx->obs->exists && // head exist(ed)
snapc.snaps.size() && // there are snaps