diff options
author | Brad Hubbard <badone@users.noreply.github.com> | 2017-06-15 04:58:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-15 04:58:17 +0200 |
commit | 15a9b59cc6d66782c359348c49434ca77229e05c (patch) | |
tree | 423a31f323ae17ad87e5bea7e5b0877aaaf75251 /src/osd | |
parent | Merge pull request #15692 from joscollin/wip-test-mon-Wreorder-warning (diff) | |
parent | osd: Change *pg_to_* to return void (diff) | |
download | ceph-15a9b59cc6d66782c359348c49434ca77229e05c.tar.xz ceph-15a9b59cc6d66782c359348c49434ca77229e05c.zip |
Merge pull request #15684 from badone/wip-refactor-of-osdmap-methods
osd/OSDMap: Change *pg_to_* to return void
Reviewed-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'src/osd')
-rw-r--r-- | src/osd/OSDMap.cc | 13 | ||||
-rw-r--r-- | src/osd/OSDMap.h | 21 |
2 files changed, 15 insertions, 19 deletions
diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index c63bc6d04ea..8097b8636a3 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -1869,7 +1869,7 @@ void OSDMap::_remove_nonexistent_osds(const pg_pool_t& pool, } } -int OSDMap::_pg_to_raw_osds( +void OSDMap::_pg_to_raw_osds( const pg_pool_t& pool, pg_t pg, vector<int> *osds, ps_t *ppps) const @@ -1887,8 +1887,6 @@ int OSDMap::_pg_to_raw_osds( if (ppps) *ppps = pps; - - return osds->size(); } int OSDMap::_pick_primary(const vector<int>& osds) const @@ -2061,17 +2059,16 @@ void OSDMap::_get_temp_osds(const pg_pool_t& pool, pg_t pg, } } -int OSDMap::pg_to_raw_osds(pg_t pg, vector<int> *raw, int *primary) const +void OSDMap::pg_to_raw_osds(pg_t pg, vector<int> *raw, int *primary) const { *primary = -1; raw->clear(); const pg_pool_t *pool = get_pg_pool(pg.pool()); if (!pool) - return 0; - int r = _pg_to_raw_osds(*pool, pg, raw, NULL); + return; + _pg_to_raw_osds(*pool, pg, raw, NULL); if (primary) *primary = _pick_primary(*raw); - return r; } void OSDMap::pg_to_raw_up(pg_t pg, vector<int> *up, int *primary) const @@ -2092,7 +2089,7 @@ void OSDMap::pg_to_raw_up(pg_t pg, vector<int> *up, int *primary) const *primary = _pick_primary(raw); _apply_primary_affinity(pps, *pool, 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, diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 5178132abbb..264fc5f7fcf 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -996,7 +996,7 @@ public: private: /// pg -> (raw osd list) - int _pg_to_raw_osds( + void _pg_to_raw_osds( const pg_pool_t& pool, pg_t pg, vector<int> *osds, ps_t *ppps) const; @@ -1037,14 +1037,13 @@ public: * by anybody for data mapping purposes. * raw and primary must be non-NULL */ - int pg_to_raw_osds(pg_t pg, vector<int> *raw, int *primary) const; + void pg_to_raw_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(const pg_t& pg, vector<int> *acting, + void 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(); } - int pg_to_acting_osds(pg_t pg, vector<int>& acting) const { + void pg_to_acting_osds(pg_t pg, vector<int>& acting) const { return pg_to_acting_osds(pg, &acting, NULL); } /** @@ -1180,26 +1179,26 @@ public: /* rank is -1 (stray), 0 (primary), 1,2,3,... (replica) */ int get_pg_acting_rank(pg_t pg, int osd) const { vector<int> group; - int nrep = pg_to_acting_osds(pg, group); - return calc_pg_rank(osd, group, nrep); + pg_to_acting_osds(pg, group); + return calc_pg_rank(osd, group, group.size()); } /* role is -1 (stray), 0 (primary), 1 (replica) */ 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); + pg_to_acting_osds(pg, group); + return calc_pg_role(osd, group, group.size()); } bool osd_is_valid_op_target(pg_t pg, int osd) const { int primary; vector<int> group; - int nrep = pg_to_acting_osds(pg, &group, &primary); + pg_to_acting_osds(pg, &group, &primary); if (osd == primary) return true; if (pg_is_ec(pg)) return false; - return calc_pg_role(osd, group, nrep) >= 0; + return calc_pg_role(osd, group, group.size()) >= 0; } int clean_pg_upmaps( |