From: David Zafman Date: Wed, 20 Nov 2019 06:21:00 +0000 (-0800) Subject: osd: For balancer crush needs the rule passed to get_parent_of_type() X-Git-Tag: v13.2.9~112^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=86a9cb2ee496bdeadae219f8cb1c601356b1098d;p=ceph.git osd: For balancer crush needs the rule passed to get_parent_of_type() Fixes: https://tracker.ceph.com/issues/42718 Signed-off-by: David Zafman (cherry picked from commit 3eb69fd0cb15974e33e675babdd5d232d69c3c6d) --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 98a870b7cbed..aef02f6560d3 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -3708,7 +3708,8 @@ int CrushWrapper::_choose_type_stack( vector::const_iterator& i, set& used, vector *pw, - int root_bucket) const + int root_bucket, + int rule) const { vector w = *pw; vector o; @@ -3743,7 +3744,7 @@ int CrushWrapper::_choose_type_stack( int item = osd; for (int j = (int)stack.size() - 2; j >= 0; --j) { int type = stack[j].first; - item = get_parent_of_type(item, type); + item = get_parent_of_type(item, type, rule); ldout(cct, 10) << __func__ << " underfull " << osd << " type " << type << " is " << item << dendl; if (!subtree_contains(root_bucket, item)) { @@ -3778,7 +3779,7 @@ int CrushWrapper::_choose_type_stack( for (int pos = 0; pos < fanout; ++pos) { if (type > 0) { // non-leaf - int item = get_parent_of_type(*tmpi, type); + int item = get_parent_of_type(*tmpi, type, rule); o.push_back(item); int n = cum_fanout; while (n-- && tmpi != orig.end()) { @@ -3850,13 +3851,13 @@ int CrushWrapper::_choose_type_stack( if (std::find(o.begin(), o.end(), alt) == o.end()) { // see if alt has the same parent if (j == 0 || - get_parent_of_type(o[pos], stack[j-1].first) == - get_parent_of_type(alt, stack[j-1].first)) { + get_parent_of_type(o[pos], stack[j-1].first, rule) == + get_parent_of_type(alt, stack[j-1].first, rule)) { if (j) ldout(cct, 10) << " replacing " << o[pos] << " (which has no underfull leaves) with " << alt << " (same parent " - << get_parent_of_type(alt, stack[j-1].first) << " type " + << get_parent_of_type(alt, stack[j-1].first, rule) << " type " << type << ")" << dendl; else ldout(cct, 10) << " replacing " << o[pos] @@ -3939,7 +3940,7 @@ int CrushWrapper::try_remap_rule( if (type > 0) type_stack.push_back(make_pair(0, 1)); int r = _choose_type_stack(cct, type_stack, overfull, underfull, orig, - i, used, &w, root_bucket); + i, used, &w, root_bucket, ruleno); if (r < 0) return r; type_stack.clear(); @@ -3961,7 +3962,7 @@ int CrushWrapper::try_remap_rule( ldout(cct, 10) << " emit " << w << dendl; if (!type_stack.empty()) { int r = _choose_type_stack(cct, type_stack, overfull, underfull, orig, - i, used, &w, root_bucket); + i, used, &w, root_bucket, ruleno); if (r < 0) return r; type_stack.clear(); diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 4faa54699d00..05f928f190e3 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -1547,7 +1547,8 @@ public: vector::const_iterator& i, set& used, vector *pw, - int root_bucket) const; + int root_bucket, + int rule) const; int try_remap_rule( CephContext *cct,