* @out: pointer to output vector
* @outpos: our position in that vector
* @recurse_to_leaf: true if we want one device under each item of given type
- * @descend_once: true if we should only try one descent before giving up
* @out2: second output vector for leaf items (if @recurse_to_leaf)
*/
static int crush_choose_firstn(const struct crush_map *map,
unsigned int attempts,
unsigned int recurse_attempts,
int recurse_to_leaf,
- int descend_once, int *out2)
+ int *out2)
{
int rep;
unsigned int ftotal, flocal;
out2, outpos,
recurse_attempts, 0,
0,
- map->chooseleaf_descend_once,
NULL) <= outpos)
/* didn't get leaf */
reject = 1;
ftotal++;
flocal++;
- if (reject && descend_once)
- /* let outer call try again */
- skip_rep = 1;
- else if (collide && flocal <= map->choose_local_tries)
+ if (collide && flocal <= map->choose_local_tries)
/* retry locally a few times */
retry_bucket = 1;
else if (map->choose_local_fallback_tries > 0 &&
int numrep;
int choose_tries = map->choose_total_tries;
int choose_leaf_tries = 0;
- const int descend_once = 0;
if ((__u32)ruleno >= map->max_rules) {
dprintk(" bad ruleno %d\n", ruleno);
}
j = 0;
if (firstn) {
+ int recurse_tries;
+ if (choose_leaf_tries)
+ recurse_tries =
+ choose_leaf_tries;
+ else if (map->chooseleaf_descend_once)
+ recurse_tries = 1;
+ else
+ recurse_tries = choose_tries;
osize += crush_choose_firstn(
map,
map->buckets[-1-w[i]],
curstep->arg2,
o+osize, j,
choose_tries,
- choose_leaf_tries ? choose_leaf_tries : choose_tries,
+ recurse_tries,
recurse_to_leaf,
- descend_once, c+osize);
+ c+osize);
} else {
crush_choose_indep(
map,
curstep->arg2,
o+osize, j,
choose_tries,
- choose_leaf_tries ? choose_leaf_tries : 1,
+ choose_leaf_tries ?
+ choose_leaf_tries : 1,
recurse_to_leaf,
c+osize,
0);