]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMap: track pgs by state for each pool
authorSage Weil <sage@redhat.com>
Fri, 6 Apr 2018 15:26:35 +0000 (10:26 -0500)
committerSage Weil <sage@redhat.com>
Fri, 7 Sep 2018 17:07:56 +0000 (12:07 -0500)
We had this globally, but it's useful to have the per-pool breakdowns.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/PGMap.cc
src/mon/PGMap.h

index 488b4a97f96403cab35a2a5ee26ab85416ff2244..8ff86665b4a1fe8571aabf4d65972724d8b13098 100644 (file)
@@ -1156,6 +1156,7 @@ void PGMap::calc_stats()
   pg_sum = pool_stat_t();
   osd_sum = osd_stat_t();
   num_pg_by_state.clear();
+  num_pg_by_pool_state.clear();
   num_pg_by_osd.clear();
 
   for (auto p = pg_stat.begin();
@@ -1177,6 +1178,7 @@ void PGMap::stat_pg_add(const pg_t &pgid, const pg_stat_t &s,
 
   num_pg++;
   num_pg_by_state[s.state]++;
+  num_pg_by_pool_state[pgid.pool()][s.state]++;
   num_pg_by_pool[pgid.pool()]++;
 
   if ((s.state & PG_STATE_CREATING) &&
@@ -1229,8 +1231,12 @@ void PGMap::stat_pg_sub(const pg_t &pgid, const pg_stat_t &s,
   ceph_assert(end >= 0);
   if (end == 0)
     num_pg_by_state.erase(s.state);
+  if (--num_pg_by_pool_state[pgid.pool()][s.state] == 0) {
+    num_pg_by_pool_state[pgid.pool()].erase(s.state);
+  }
   end = --num_pg_by_pool[pgid.pool()];
   if (end == 0) {
+    num_pg_by_pool_state.erase(pgid.pool());
     num_pg_by_pool.erase(pgid.pool());
     pg_pool_sum.erase(pgid.pool());
   }
index 89b8eb6b402937b7425ddc24748c227ed70e72eb..ce4d9efab0a37213b22eacc5695f18889b4d192b 100644 (file)
@@ -281,6 +281,7 @@ public:
   mempool::pgmap::unordered_map<int,set<pg_t> > pg_by_osd;
   mempool::pgmap::unordered_map<int,int> blocked_by_sum;
   mempool::pgmap::list< pair<pool_stat_t, utime_t> > pg_sum_deltas;
+  mempool::pgmap::unordered_map<int64_t,mempool::pgmap::unordered_map<uint64_t,int32_t>> num_pg_by_pool_state;
 
   utime_t stamp;