From: Sage Weil Date: Mon, 9 Dec 2019 16:42:39 +0000 (-0600) Subject: osd/OSDMap: fix+simplify is_up_acting_osd_shard X-Git-Tag: v15.1.0~577^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=451c5cadf176f4bbc896dbd121bcb65c4e3f5c8c;p=ceph.git osd/OSDMap: fix+simplify is_up_acting_osd_shard Use the new calc_pg_role() to simplify this function Signed-off-by: Sage Weil --- diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 31cf9b2c8e0..225d9717ac9 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -1380,15 +1380,9 @@ public: bool is_up_acting_osd_shard(spg_t pg, int osd) const { std::vector 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; }