From: Somnath Roy Date: Fri, 27 Jun 2014 18:06:22 +0000 (-0700) Subject: OSDMap: avoid passing pg_t by value X-Git-Tag: v0.84~121^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=af4970caa5773eadcf3838f792fac94869b8ece8;p=ceph.git OSDMap: avoid passing pg_t by value Passing pg_t param by cons ref for avoiding copies. Signed-off-by: Somnath Roy --- diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 8d2a346fb64..05ffb2417e4 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -1578,7 +1578,7 @@ void OSDMap::pg_to_raw_up(pg_t pg, vector *up, int *primary) const _apply_primary_affinity(pps, *pool, up, primary); } -void OSDMap::_pg_to_up_acting_osds(pg_t pg, vector *up, int *up_primary, +void OSDMap::_pg_to_up_acting_osds(const pg_t& pg, vector *up, int *up_primary, vector *acting, int *acting_primary) const { const pg_pool_t *pool = get_pg_pool(pg.pool()); diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index e3ac29a1107..bcbfdb7f213 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -617,7 +617,7 @@ private: /** * map to up and acting. Fills in whatever fields are non-NULL. */ - void _pg_to_up_acting_osds(pg_t pg, vector *up, int *up_primary, + void _pg_to_up_acting_osds(const pg_t& pg, vector *up, int *up_primary, vector *acting, int *acting_primary) const; public: @@ -629,7 +629,7 @@ public: */ int pg_to_osds(pg_t pg, vector *raw, int *primary) const; /// map a pg to its acting set. @return acting set size - int pg_to_acting_osds(pg_t pg, vector *acting, + int pg_to_acting_osds(const pg_t& pg, vector *acting, int *acting_primary) const { _pg_to_up_acting_osds(pg, NULL, NULL, acting, acting_primary); return acting->size(); @@ -664,7 +664,7 @@ public: assert(i != pools.end()); return i->second.ec_pool(); } - bool get_primary_shard(pg_t pgid, spg_t *out) const { + bool get_primary_shard(const pg_t& pgid, spg_t *out) const { map::const_iterator i = get_pools().find(pgid.pool()); if (i == get_pools().end()) { return false; @@ -766,7 +766,7 @@ public: return calc_pg_rank(osd, group, nrep); } /* role is -1 (stray), 0 (primary), 1 (replica) */ - int get_pg_acting_role(pg_t pg, int osd) const { + int get_pg_acting_role(const pg_t& pg, int osd) const { vector group; int nrep = pg_to_acting_osds(pg, group); return calc_pg_role(osd, group, nrep);