]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/OSDMapMapper: count total pgs
authorSage Weil <sage@redhat.com>
Tue, 31 Jan 2017 20:03:17 +0000 (15:03 -0500)
committerSage Weil <sage@redhat.com>
Thu, 16 Feb 2017 17:04:08 +0000 (12:04 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSDMapMapping.cc
src/osd/OSDMapMapping.h

index 55cd22428f02b4868394b60ce50ea12ccdd643ca..9edd23ebe2a0e4bf208a5cb01a5ead5f357d732d 100644 (file)
 // the dimensions (pg_num and size) match up.
 void OSDMapMapping::_init_mappings(const OSDMap& osdmap)
 {
+  num_pgs = 0;
   auto q = pools.begin();
   for (auto& p : osdmap.get_pools()) {
+    num_pgs += p.second.get_pg_num();
     // drop unneeded pools
     while (q != pools.end() && q->first < p.first) {
       q = pools.erase(q);
index cb9498c371a12a9bf8081a9f79fe36444d1613b9..95fed453f9cf24843e66bab8d53202a6c786d6e8 100644 (file)
@@ -85,6 +85,7 @@ class OSDMapMapping {
   std::vector<std::vector<pg_t>> acting_rmap;  // osd -> pg
   //unused: std::vector<std::vector<pg_t>> up_rmap;  // osd -> pg
   epoch_t epoch;
+  uint64_t num_pgs = 0;
 
   void _init_mappings(const OSDMap& osdmap);
   void _update_range(
@@ -131,6 +132,10 @@ public:
   epoch_t get_epoch() const {
     return epoch;
   }
+
+  uint64_t get_num_pgs() const {
+    return num_pgs;
+  }
 };
 
 /// thread pool to calculate mapping on multiple CPUs