I found some problem in CRUSH code
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
Hi,
Yes, that's a bug... Those ='s should be -, as with the straw bucket type. Opened http://tracker.newdream.net/issues/2096
Thanks! This'll be fixed in v0.43.
sage
Quoted 38 lines · ZhuRongze
Hi,
The function
crush_adjust_tree_bucket_item_weightinceph-0.41/src/crush/builder.cseem to have a bug. The argument weight is no use, because it is assigned .
--------------------------------------------------------------------
intcrush_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 functioncrush_adjust_list_bucket_item_weightalso have a same problem.-ZhuRongze