aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph/crush/mapper.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-12-13 17:59:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-12-13 17:59:42 -0500
commit653f42f6b6348652c02737924abd6a5a6426e7ee (patch)
tree466d9d722742f8f9c553226ffce200dc62f494ab /net/ceph/crush/mapper.c
parent4dde6dedad736b86bcea3722abb7d8031aeeaa16 (diff)
parent9d5a09e659f8414dd3713e2acbfaf8a9e9794aa1 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: ceph: add missing spin_unlock at ceph_mdsc_build_path() ceph: fix SEEK_CUR, SEEK_SET regression crush: fix mapping calculation when force argument doesn't exist ceph: use i_ceph_lock instead of i_lock rbd: remove buggy rollback functionality rbd: return an error when an invalid header is read ceph: fix rasize reporting by ceph_show_options
Diffstat (limited to 'net/ceph/crush/mapper.c')
-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