If the (first) TAKE in the crush rule is not the root, see if they picked
a point somewhere beneath the appropriate part of the hierachy. If not,
continue with a normal mapping.
Previously we would simply error out in this case and map nothing.
Signed-off-by: Sage Weil <sage@newdream.net>
/*
* determine hierarchical context of force, if any. note
* that this may or may not correspond to the specific types
- * referenced by the crush rule.
+ * referenced by the crush rule. it will also only affect
+ * the first descent (TAKE).
*/
if (force >= 0 &&
force < map->max_devices &&
switch (rule->steps[step].op) {
case CRUSH_RULE_TAKE:
w[0] = rule->steps[step].arg1;
- if (force_pos >= 0) {
- if (force_context[force_pos] != w[0]) {
- rc = -1; /* forced mapping dne */
- goto out;
- }
+
+ /* find position in force_context/hierarchy */
+ while (force_pos >= 0 && force_context[force_pos] != w[0])
force_pos--;
- }
+ /* and move past it */
+ if (force_pos >= 0)
+ force_pos--;
+
wsize = 1;
break;