crush: adjust max_devices appropriately in insert_item()

If we insert a new item, make sure max_devices is still the max id + 1.

Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2012-05-12 14:33:51 -07:00 committed by Sage Weil
parent 320d1ebf9e
commit 376f0d509b

View File

@ -172,6 +172,12 @@ int CrushWrapper::insert_item(CephContext *cct, int item, float weight, string n
// now that we've added the (0-weighted) item and any parent buckets, adjust the weight.
adjust_item_weightf(cct, item, weight);
if (item >= crush->max_devices) {
crush->max_devices = item + 1;
ldout(cct, 5) << "insert_item max_devices now " << crush->max_devices << dendl;
}
return 0;
}