}
}
-void PGMap::get_filtered_pg_stats(const string& state, int64_t poolid, int64_t osdid,
+void PGMap::get_filtered_pg_stats(uint32_t state, int64_t poolid, int64_t osdid,
bool primary, set<pg_t>& pgs)
{
- int type = 0;
- if (state != "all") {
- type = pg_string_state(state);
- if (type == -1)
- assert(0 == "invalid type");
- }
-
for (ceph::unordered_map<pg_t, pg_stat_t>::const_iterator i = pg_stat.begin();
i != pg_stat.end();
++i) {
continue;
if ((osdid >= 0) && !(i->second.is_acting_osd(osdid,primary)))
continue;
- if ((state != "all") && !(i->second.state & type))
+ if (!(i->second.state & state))
continue;
pgs.insert(i->first);
}
void dump_osd_blocked_by_stats(Formatter *f) const;
void print_osd_blocked_by_stats(std::ostream *ss) const;
- void get_filtered_pg_stats(const string& state, int64_t poolid, int64_t osdid,
+ void get_filtered_pg_stats(uint32_t state, int64_t poolid, int64_t osdid,
bool primary, set<pg_t>& pgs);
void recovery_summary(Formatter *f, list<string> *psl,
const pool_stat_t& delta_sum) const;
}
if (states.empty())
states.push_back("all");
+
+ uint32_t state = 0;
+
while (!states.empty()) {
- string state = states.back();
- pg_map.get_filtered_pg_stats(state,pool,osd,primary,pgs);
+ string state_str = states.back();
+
+ if (state_str == "all") {
+ state = -1;
+ break;
+ } else {
+ int filter = pg_string_state(state_str);
+ assert(filter != -1);
+ state |= filter;
+ }
+
states.pop_back();
}
+
+ pg_map.get_filtered_pg_stats(state, pool, osd, primary, pgs);
+
if (f && !pgs.empty()) {
- pg_map.dump_filtered_pg_stats(f.get(),pgs);
+ pg_map.dump_filtered_pg_stats(f.get(), pgs);
f->flush(ds);
} else if (!pgs.empty()) {
- pg_map.dump_filtered_pg_stats(ds,pgs);
+ pg_map.dump_filtered_pg_stats(ds, pgs);
}
r = 0;
} else if (prefix == "pg dump_stuck") {