Skip to content

Commit

Permalink
Merge pull request #12190 from liupan1111/wip-speed-up-acting-ods
Browse files Browse the repository at this point in the history
osd/OSDMap: improve the performance of pg_to_acting_osds

Reviewed-by: Sage Weil <sage@redhat.com>
Reviewed-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information
tchaikov committed Dec 12, 2016
2 parents 6af0c8f + 79b90a2 commit 2bdf593
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/osd/OSDMap.cc
Expand Up @@ -1720,20 +1720,24 @@ void OSDMap::_pg_to_up_acting_osds(const pg_t& pg, vector<int> *up, int *up_prim
int _up_primary;
int _acting_primary;
ps_t pps;
_pg_to_raw_osds(*pool, pg, &raw, &_up_primary, &pps);
_raw_to_up_osds(*pool, raw, &_up, &_up_primary);
_apply_primary_affinity(pps, *pool, &_up, &_up_primary);
_get_temp_osds(*pool, pg, &_acting, &_acting_primary);
if (_acting.empty()) {
_acting = _up;
if (_acting_primary == -1) {
_acting_primary = _up_primary;
if (_acting.empty() || up || up_primary) {
_pg_to_raw_osds(*pool, pg, &raw, &_up_primary, &pps);
_raw_to_up_osds(*pool, raw, &_up, &_up_primary);
_apply_primary_affinity(pps, *pool, &_up, &_up_primary);
if (_acting.empty()) {
_acting = _up;
if (_acting_primary == -1) {
_acting_primary = _up_primary;
}
}

if (up)
up->swap(_up);
if (up_primary)
*up_primary = _up_primary;
}
if (up)
up->swap(_up);
if (up_primary)
*up_primary = _up_primary;

if (acting)
acting->swap(_acting);
if (acting_primary)
Expand Down

0 comments on commit 2bdf593

Please sign in to comment.