aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ceph/crush/mapper.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c
index c727836b5860..e3ade074541c 100644
--- a/net/ceph/crush/mapper.c
+++ b/net/ceph/crush/mapper.c
@@ -455,11 +455,13 @@ reject:
455 * 455 *
456 */ 456 */
457static void crush_choose_indep(const struct crush_map *map, 457static void crush_choose_indep(const struct crush_map *map,
458 struct crush_bucket *bucket, 458 struct crush_bucket *bucket,
459 const __u32 *weight, int weight_max, 459 const __u32 *weight, int weight_max,
460 int x, int left, int numrep, int type, 460 int x, int left, int numrep, int type,
461 int *out, int outpos, 461 int *out, int outpos,
462 int recurse_to_leaf, 462 unsigned int attempts,
463 unsigned int recurse_attempts,
464 int recurse_to_leaf,
463 int *out2, 465 int *out2,
464 int parent_r) 466 int parent_r)
465{ 467{
@@ -483,7 +485,7 @@ static void crush_choose_indep(const struct crush_map *map,
483 out2[rep] = CRUSH_ITEM_UNDEF; 485 out2[rep] = CRUSH_ITEM_UNDEF;
484 } 486 }
485 487
486 for (ftotal = 0; left > 0 && ftotal < map->choose_total_tries; ftotal++) { 488 for (ftotal = 0; left > 0 && ftotal < attempts; ftotal++) {
487 for (rep = outpos; rep < endpos; rep++) { 489 for (rep = outpos; rep < endpos; rep++) {
488 if (out[rep] != CRUSH_ITEM_UNDEF) 490 if (out[rep] != CRUSH_ITEM_UNDEF)
489 continue; 491 continue;
@@ -564,11 +566,12 @@ static void crush_choose_indep(const struct crush_map *map,
564 if (recurse_to_leaf) { 566 if (recurse_to_leaf) {
565 if (item < 0) { 567 if (item < 0) {
566 crush_choose_indep(map, 568 crush_choose_indep(map,
567 map->buckets[-1-item], 569 map->buckets[-1-item],
568 weight, weight_max, 570 weight, weight_max,
569 x, 1, numrep, 0, 571 x, 1, numrep, 0,
570 out2, rep, 572 out2, rep,
571 0, NULL, r); 573 recurse_attempts, 0,
574 0, NULL, r);
572 if (out2[rep] == CRUSH_ITEM_NONE) { 575 if (out2[rep] == CRUSH_ITEM_NONE) {
573 /* placed nothing; no leaf */ 576 /* placed nothing; no leaf */
574 break; 577 break;
@@ -631,6 +634,7 @@ int crush_do_rule(const struct crush_map *map,
631 __u32 step; 634 __u32 step;
632 int i, j; 635 int i, j;
633 int numrep; 636 int numrep;
637 int choose_leaf_tries = 1;
634 const int descend_once = 0; 638 const int descend_once = 0;
635 639
636 if ((__u32)ruleno >= map->max_rules) { 640 if ((__u32)ruleno >= map->max_rules) {
@@ -653,6 +657,11 @@ int crush_do_rule(const struct crush_map *map,
653 wsize = 1; 657 wsize = 1;
654 break; 658 break;
655 659
660 case CRUSH_RULE_SET_CHOOSE_LEAF_TRIES:
661 if (curstep->arg1 > 0)
662 choose_leaf_tries = curstep->arg1;
663 break;
664
656 case CRUSH_RULE_CHOOSE_LEAF_FIRSTN: 665 case CRUSH_RULE_CHOOSE_LEAF_FIRSTN:
657 case CRUSH_RULE_CHOOSE_FIRSTN: 666 case CRUSH_RULE_CHOOSE_FIRSTN:
658 firstn = 1; 667 firstn = 1;
@@ -702,6 +711,8 @@ int crush_do_rule(const struct crush_map *map,
702 x, numrep, numrep, 711 x, numrep, numrep,
703 curstep->arg2, 712 curstep->arg2,
704 o+osize, j, 713 o+osize, j,
714 map->choose_total_tries,
715 choose_leaf_tries,
705 recurse_to_leaf, 716 recurse_to_leaf,
706 c+osize, 717 c+osize,
707 0); 718 0);