]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMap: access num pgs by osd
authorSage Weil <sage@redhat.com>
Tue, 9 Jun 2015 21:56:08 +0000 (17:56 -0400)
committerSage Weil <sage@redhat.com>
Tue, 9 Jun 2015 21:56:42 +0000 (17:56 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/PGMap.h

index a2676432d2360518a9b812f96f4a04bfa89fba3a..3df2c49e7e591f86962d552fffc2165f5263e0d1 100644 (file)
@@ -233,6 +233,14 @@ public:
     stamp = s;
   }
 
+  size_t get_num_pg_by_osd(int osd) const {
+    ceph::unordered_map<int,set<pg_t> >::const_iterator p = pg_by_osd.find(osd);
+    if (p == pg_by_osd.end())
+      return 0;
+    else
+      return p->second.size();
+  }
+
   pool_stat_t get_pg_pool_sum_stat(int64_t pool) const {
     ceph::unordered_map<int,pool_stat_t>::const_iterator p =
       pg_pool_sum.find(pool);