Hi,
The function crush_adjust_tree_bucket_item_weight in
ceph-0.41/src/crush/builder.c seem to have a bug. The argument weight
is no use, because it is assigned .
--------------------------------------------------------------------
int crush_adjust_tree_bucket_item_weight(struct crush_bucket_tree
*bucket, int item, int weight)
{
int diff;
int node;
unsigned i, j;
unsigned depth = calc_depth(bucket->h.size);
for (i = 0; i < bucket->h.size; i++) {
if (bucket->h.items[i] == item)
break;
}
if (i == bucket->h.size)
return 0;
node = crush_calc_tree_node(i);
diff = weight = bucket->node_weights[node];
bucket->node_weights[node] = weight;
bucket->h.weight += diff;
for (j=1; j<depth; j++) {
node = parent(node);
bucket->node_weights[node] += diff;
}
return diff;
--------------------------------------------------------------------
The function crush_adjust_list_bucket_item_weight also have a same problem.
-ZhuRongze
begin:vcard
fn:Rongze Zhu
n:Zhu;Rongze
org:SINA;SWS
version:2.1
end:vcard