From 05fc59bee9138d04227255a2f31bd82efe94b1e9 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 5 Jun 2015 12:15:22 -0700 Subject: [PATCH] crush/CrushWrapper: adjust subtree base in adjust_subtree_weight We were correctly adjusting all the children, but the subtree root was not being updated. Fixes: #11855 Signed-off-by: Sage Weil (cherry picked from commit 1da96ab8442522bda4fc39e05597f17b8ebddf89) --- src/crush/CrushWrapper.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index ec3414b3dda..407a6be88f0 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -842,10 +842,12 @@ int CrushWrapper::adjust_subtree_weight(CephContext *cct, int id, int weight) while (!q.empty()) { b = q.front(); q.pop_front(); + int local_changed = 0; for (unsigned i=0; isize; ++i) { int n = b->items[i]; if (n >= 0) { crush_bucket_adjust_item_weight(crush, b, n, weight); + ++local_changed; } else { crush_bucket *sub = get_bucket(n); if (IS_ERR(sub)) @@ -853,6 +855,9 @@ int CrushWrapper::adjust_subtree_weight(CephContext *cct, int id, int weight) q.push_back(sub); } } + if (local_changed) { + adjust_item_weight(cct, b->id, b->weight); + } } return changed; } -- 2.47.3