From: Sage Weil Date: Sat, 22 Feb 2014 17:35:27 +0000 (-0800) Subject: mon/PGMap: only recalculate min_last_epoch_clean if incremental touches old min X-Git-Tag: v0.79~141^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fc85075167421288053e0f73b1e14c4aec020a49;p=ceph.git mon/PGMap: only recalculate min_last_epoch_clean if incremental touches old min If the Incremental updates a value that used to equal the old min, we may have raised it and need to recalculate it at the end. Otherwise, we can avoid recalculating at all! Signed-off-by: Sage Weil --- diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 72a60d9ac24..4eb70fe3bea 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -207,7 +207,20 @@ void PGMap::apply_incremental(CephContext *cct, const Incremental& inc) if (t == pg_stat.end()) { ceph::unordered_map::value_type v(update_pg, update_stat); pg_stat.insert(v); + // did we affect the min? + if (min_last_epoch_clean && + update_stat.get_effective_last_epoch_clean() < min_last_epoch_clean) + min_last_epoch_clean = 0; } else { + // did we (or might we) affect the min? + epoch_t lec = update_stat.get_effective_last_epoch_clean(); + if (min_last_epoch_clean && + (lec < min_last_epoch_clean || // we did + (lec > min_last_epoch_clean && // we might + t->second.get_effective_last_epoch_clean() == min_last_epoch_clean) + )) + min_last_epoch_clean = 0; + stat_pg_sub(update_pg, t->second); t->second = update_stat; } @@ -229,9 +242,22 @@ void PGMap::apply_incremental(CephContext *cct, const Incremental& inc) stat_osd_sub(t->second); t->second = new_stats; } + ceph::unordered_map::iterator i = osd_epochs.find(osd); map::const_iterator j = inc.get_osd_epochs().find(osd); assert(j != inc.get_osd_epochs().end()); - osd_epochs[j->first] = j->second; + + // will we potentially affect the min? + if (min_last_epoch_clean && + (i == osd_epochs.end() || + j->second < min_last_epoch_clean || + (j->second > min_last_epoch_clean && + i->second == min_last_epoch_clean))) + min_last_epoch_clean = 0; + + if (i == osd_epochs.end()) + osd_epochs.insert(*j); + else + i->second = j->second; stat_osd_add(new_stats);