We need to take PGs whose mapping has not changed in a long time into
account. For them, the pg state will indicate it was clean at the time of
the report, in which case we can use that as a lower-bound on their actual
latest epoch clean. If they are not currently clean (at report time), use
the last_epoch_clean value.
Fixes: #5519
Signed-off-by: Sage Weil <sage@inktank.com>
if (pg_stat.empty())
return 0;
hash_map<pg_t,pg_stat_t>::const_iterator p = pg_stat.begin();
- epoch_t min = p->second.last_epoch_clean;
+ epoch_t min = p->second.get_effective_last_epoch_clean();
for (++p; p != pg_stat.end(); ++p) {
- if (p->second.last_epoch_clean < min)
- min = p->second.last_epoch_clean;
+ epoch_t lec = p->second.get_effective_last_epoch_clean();
+ if (lec < min)
+ min = lec;
}
return min;
}
mapping_epoch(0)
{ }
+ epoch_t get_effective_last_epoch_clean() const {
+ if (state & PG_STATE_CLEAN) {
+ // we are clean as of this report, and should thus take the
+ // reported epoch
+ return reported.epoch;
+ } else {
+ return last_epoch_clean;
+ }
+ }
+
void add(const pg_stat_t& o) {
stats.add(o.stats);
log_size += o.log_size;