aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ceph/crush/mapper.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c
index 42599e31dcad..3a94eae7abe9 100644
--- a/net/ceph/crush/mapper.c
+++ b/net/ceph/crush/mapper.c
@@ -477,7 +477,6 @@ int crush_do_rule(struct crush_map *map,
477 int i, j; 477 int i, j;
478 int numrep; 478 int numrep;
479 int firstn; 479 int firstn;
480 int rc = -1;
481 480
482 BUG_ON(ruleno >= map->max_rules); 481 BUG_ON(ruleno >= map->max_rules);
483 482
@@ -491,23 +490,18 @@ int crush_do_rule(struct crush_map *map,
491 * that this may or may not correspond to the specific types 490 * that this may or may not correspond to the specific types
492 * referenced by the crush rule. 491 * referenced by the crush rule.
493 */ 492 */
494 if (force >= 0) { 493 if (force >= 0 &&
495 if (force >= map->max_devices || 494 force < map->max_devices &&
496 map->device_parents[force] == 0) { 495 map->device_parents[force] != 0 &&
497 /*dprintk("CRUSH: forcefed device dne\n");*/ 496 !is_out(map, weight, force, x)) {
498 rc = -1; /* force fed device dne */ 497 while (1) {
499 goto out; 498 force_context[++force_pos] = force;
500 } 499 if (force >= 0)
501 if (!is_out(map, weight, force, x)) { 500 force = map->device_parents[force];
502 while (1) { 501 else
503 force_context[++force_pos] = force; 502 force = map->bucket_parents[-1-force];
504 if (force >= 0) 503 if (force == 0)
505 force = map->device_parents[force]; 504 break;
506 else
507 force = map->bucket_parents[-1-force];
508 if (force == 0)
509 break;
510 }
511 } 505 }
512 } 506 }
513 507
@@ -600,10 +594,7 @@ int crush_do_rule(struct crush_map *map,
600 BUG_ON(1); 594 BUG_ON(1);
601 } 595 }
602 } 596 }
603 rc = result_len; 597 return result_len;
604
605out:
606 return rc;
607} 598}
608 599
609 600