diff options
-rw-r--r-- | src/crush/mapper.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/crush/mapper.c b/src/crush/mapper.c index cb8195aa575..609256b6c47 100644 --- a/src/crush/mapper.c +++ b/src/crush/mapper.c @@ -512,10 +512,12 @@ int crush_do_rule(struct crush_map *map, } for (step = 0; step < rule->len; step++) { + struct crush_rule_step *curstep = &rule->steps[step]; + firstn = 0; - switch (rule->steps[step].op) { + switch (curstep->op) { case CRUSH_RULE_TAKE: - w[0] = rule->steps[step].arg1; + w[0] = curstep->arg1; if (force_pos >= 0) { if (force_context[force_pos] != w[0]) { rc = -1; /* forced mapping dne */ @@ -535,9 +537,9 @@ int crush_do_rule(struct crush_map *map, BUG_ON(wsize == 0); recurse_to_leaf = - rule->steps[step].op == + curstep->op == CRUSH_RULE_CHOOSE_LEAF_FIRSTN || - rule->steps[step].op == + curstep->op == CRUSH_RULE_CHOOSE_LEAF_INDEP; /* reset output */ @@ -549,7 +551,7 @@ int crush_do_rule(struct crush_map *map, * basically, numrep <= 0 means relative to * the provided result_max */ - numrep = rule->steps[step].arg1; + numrep = curstep->arg1; if (numrep <= 0) { numrep += result_max; if (numrep <= 0) @@ -560,7 +562,7 @@ int crush_do_rule(struct crush_map *map, /* skip any intermediate types */ while (force_pos && force_context[force_pos] < 0 && - rule->steps[step].arg2 != + curstep->arg2 != map->buckets[-1 - force_context[force_pos]]->type) force_pos--; @@ -574,7 +576,7 @@ int crush_do_rule(struct crush_map *map, map->buckets[-1-w[i]], weight, x, numrep, - rule->steps[step].arg2, + curstep->arg2, o+osize, j, firstn, recurse_to_leaf, c+osize); |