]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: fix+simplify is_up_acting_osd_shard
authorSage Weil <sage@redhat.com>
Mon, 9 Dec 2019 16:42:39 +0000 (10:42 -0600)
committerSage Weil <sage@redhat.com>
Mon, 9 Dec 2019 16:42:39 +0000 (10:42 -0600)
Use the new calc_pg_role() to simplify this function

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSDMap.h

index 31cf9b2c8e0a549d3255709e405753ac621dffd7..225d9717ac9dfbccd2a0d24f1066502813d75a2d 100644 (file)
@@ -1380,15 +1380,9 @@ public:
   bool is_up_acting_osd_shard(spg_t pg, int osd) const {
     std::vector<int> up, acting;
     _pg_to_up_acting_osds(pg.pgid, &up, NULL, &acting, NULL, false);
-    if (pg.shard == shard_id_t::NO_SHARD) {
-      if (calc_pg_role(osd, acting, acting.size()) >= 0 ||
-         calc_pg_role(osd, up, up.size()) >= 0)
-       return true;
-    } else {
-      if (pg.shard < (int)acting.size() && acting[pg.shard] == osd)
-       return true;
-      if (pg.shard < (int)up.size() && up[pg.shard] == osd)
-       return true;
+    if (calc_pg_role(pg_shard_t(osd, pg.shard), acting) >= 0 ||
+       calc_pg_role(pg_shard_t(osd, pg.shard), up) >= 0) {
+      return true;
     }
     return false;
   }