Pass down the parent's 'r' value so that we will sample different values in
the recursive call when the parent tries multiple times. This avoids doing
useless work (calling multiple times and trying the same values).
Signed-off-by: Sage Weil <sage@inktank.com>
const __u32 *weight, int weight_max,
int *out, int outpos,
int recurse_to_leaf,
- int *out2)
int x, int left, int numrep, int type,
+ int *out2,
+ int parent_r)
{
struct crush_bucket *in = bucket;
int endpos = outpos + left;
* this will involve more devices in data
* movement and tend to distribute the load.
*/
- r = rep;
+ r = rep + parent_r;
/* be careful */
if (in->alg == CRUSH_BUCKET_UNIFORM &&
map->buckets[-1-item],
weight, weight_max,
out2, rep,
- 0, NULL);
x, 1, numrep, 0,
+ 0, NULL, r);
if (out2[rep] == CRUSH_ITEM_NONE) {
/* placed nothing; no leaf */
break;
curstep->arg2,
o+osize, j,
recurse_to_leaf,
- c+osize);
+ c+osize,
+ 0);
osize += numrep;
}
}