]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: get_item_weight must not fail on root
authorLoic Dachary <ldachary@redhat.com>
Sat, 18 Feb 2017 22:02:47 +0000 (23:02 +0100)
committerLoic Dachary <ldachary@redhat.com>
Wed, 1 Mar 2017 16:24:08 +0000 (17:24 +0100)
Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/crush/CrushWrapper.cc

index 3be8a11c237770aad4d40b8f083dfaa1c3c7a225..a5c744847ee5f8344840d9a2f3e2e9a4356e9890 100644 (file)
@@ -818,6 +818,8 @@ int CrushWrapper::get_item_weight(int id) const
     crush_bucket *b = crush->buckets[bidx];
     if (b == NULL)
       continue;
+    if (b->id == id)
+      return b->weight;
     for (unsigned i = 0; i < b->size; i++)
       if (b->items[i] == id)
        return crush_get_bucket_item_weight(b, i);