]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushWrapper: adjust subtree base in adjust_subtree_weight
authorSage Weil <sage@redhat.com>
Fri, 5 Jun 2015 19:15:22 +0000 (12:15 -0700)
committerSage Weil <sage@redhat.com>
Mon, 8 Jun 2015 00:06:35 +0000 (20:06 -0400)
We were correctly adjusting all the children, but the subtree root was
not being updated.

Fixes: #11855
Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/CrushWrapper.cc

index e9a963d3a62fd76dca5aec3e7db1cd60290d0685..20bf929d9f1f53057c16fac121f486f7d21ec82d 100644 (file)
@@ -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; i<b->size; ++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;
 }