]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMap: avoid passing pg_t by value
authorSomnath Roy <somnath.roy@sandisk.com>
Fri, 27 Jun 2014 18:06:22 +0000 (11:06 -0700)
committerSomnath Roy <somnath.roy@sandisk.com>
Fri, 27 Jun 2014 18:06:22 +0000 (11:06 -0700)
Passing pg_t param by cons ref for avoiding copies.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
src/osd/OSDMap.cc
src/osd/OSDMap.h

index 8d2a346fb64b8a271aad869b40cdf6e4a062910c..05ffb2417e48ab40bc8f9e9f76d166a4afef1220 100644 (file)
@@ -1578,7 +1578,7 @@ void OSDMap::pg_to_raw_up(pg_t pg, vector<int> *up, int *primary) const
   _apply_primary_affinity(pps, *pool, up, primary);
 }
   
-void OSDMap::_pg_to_up_acting_osds(pg_t pg, vector<int> *up, int *up_primary,
+void OSDMap::_pg_to_up_acting_osds(const pg_t& pg, vector<int> *up, int *up_primary,
                                    vector<int> *acting, int *acting_primary) const
 {
   const pg_pool_t *pool = get_pg_pool(pg.pool());
index e3ac29a1107044991193db232dd250d5d3c66da6..bcbfdb7f2131fc2cb3c5bd9e0135f11903ca5101 100644 (file)
@@ -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<int> *up, int *up_primary,
+  void _pg_to_up_acting_osds(const pg_t& pg, vector<int> *up, int *up_primary,
                              vector<int> *acting, int *acting_primary) const;
 
 public:
@@ -629,7 +629,7 @@ public:
    */
   int pg_to_osds(pg_t pg, vector<int> *raw, int *primary) const;
   /// map a pg to its acting set. @return acting set size
-  int pg_to_acting_osds(pg_t pg, vector<int> *acting,
+  int pg_to_acting_osds(const pg_t& pg, vector<int> *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<int64_t, pg_pool_t>::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<int> group;
     int nrep = pg_to_acting_osds(pg, group);
     return calc_pg_role(osd, group, nrep);