Commit f1932fc1 authored by Sage Weil's avatar Sage Weil

crush: fix mapping calculation when force argument doesn't exist

If the force argument isn't valid, we should continue calculating a
mapping as if it weren't specified.
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent be655596
...@@ -477,7 +477,6 @@ int crush_do_rule(struct crush_map *map, ...@@ -477,7 +477,6 @@ int crush_do_rule(struct crush_map *map,
int i, j; int i, j;
int numrep; int numrep;
int firstn; int firstn;
int rc = -1;
BUG_ON(ruleno >= map->max_rules); BUG_ON(ruleno >= map->max_rules);
...@@ -491,23 +490,18 @@ int crush_do_rule(struct crush_map *map, ...@@ -491,23 +490,18 @@ int crush_do_rule(struct crush_map *map,
* that this may or may not correspond to the specific types * that this may or may not correspond to the specific types
* referenced by the crush rule. * referenced by the crush rule.
*/ */
if (force >= 0) { if (force >= 0 &&
if (force >= map->max_devices || force < map->max_devices &&
map->device_parents[force] == 0) { map->device_parents[force] != 0 &&
/*dprintk("CRUSH: forcefed device dne\n");*/ !is_out(map, weight, force, x)) {
rc = -1; /* force fed device dne */ while (1) {
goto out; force_context[++force_pos] = force;
} if (force >= 0)
if (!is_out(map, weight, force, x)) { force = map->device_parents[force];
while (1) { else
force_context[++force_pos] = force; force = map->bucket_parents[-1-force];
if (force >= 0) if (force == 0)
force = map->device_parents[force]; break;
else
force = map->bucket_parents[-1-force];
if (force == 0)
break;
}
} }
} }
...@@ -600,10 +594,7 @@ int crush_do_rule(struct crush_map *map, ...@@ -600,10 +594,7 @@ int crush_do_rule(struct crush_map *map,
BUG_ON(1); BUG_ON(1);
} }
} }
rc = result_len; return result_len;
out:
return rc;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment