diff options
-rw-r--r-- | include/linux/crush/crush.h | 5 | ||||
-rw-r--r-- | net/ceph/crush/mapper.c | 14 |
2 files changed, 14 insertions, 5 deletions
diff --git a/include/linux/crush/crush.h b/include/linux/crush/crush.h index 2e50bab91655..07b8fd4f81fc 100644 --- a/include/linux/crush/crush.h +++ b/include/linux/crush/crush.h | |||
@@ -165,7 +165,10 @@ struct crush_map { | |||
165 | __u32 choose_local_fallback_tries; | 165 | __u32 choose_local_fallback_tries; |
166 | /* choose attempts before giving up */ | 166 | /* choose attempts before giving up */ |
167 | __u32 choose_total_tries; | 167 | __u32 choose_total_tries; |
168 | /* attempt chooseleaf inner descent once; on failure retry outer descent */ | 168 | /* attempt chooseleaf inner descent once for firstn mode; on |
169 | * reject retry outer descent. Note that this does *not* | ||
170 | * apply to a collision: in that case we will retry as we used | ||
171 | * to. */ | ||
169 | __u32 chooseleaf_descend_once; | 172 | __u32 chooseleaf_descend_once; |
170 | }; | 173 | }; |
171 | 174 | ||
diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c index e3ade074541c..c34320518c8b 100644 --- a/net/ceph/crush/mapper.c +++ b/net/ceph/crush/mapper.c | |||
@@ -299,6 +299,8 @@ static int crush_choose_firstn(const struct crush_map *map, | |||
299 | const __u32 *weight, int weight_max, | 299 | const __u32 *weight, int weight_max, |
300 | int x, int numrep, int type, | 300 | int x, int numrep, int type, |
301 | int *out, int outpos, | 301 | int *out, int outpos, |
302 | unsigned int attempts, | ||
303 | unsigned int recurse_attempts, | ||
302 | int recurse_to_leaf, | 304 | int recurse_to_leaf, |
303 | int descend_once, int *out2) | 305 | int descend_once, int *out2) |
304 | { | 306 | { |
@@ -385,6 +387,7 @@ static int crush_choose_firstn(const struct crush_map *map, | |||
385 | weight, weight_max, | 387 | weight, weight_max, |
386 | x, outpos+1, 0, | 388 | x, outpos+1, 0, |
387 | out2, outpos, | 389 | out2, outpos, |
390 | recurse_attempts, 0, | ||
388 | 0, | 391 | 0, |
389 | map->chooseleaf_descend_once, | 392 | map->chooseleaf_descend_once, |
390 | NULL) <= outpos) | 393 | NULL) <= outpos) |
@@ -421,7 +424,7 @@ reject: | |||
421 | flocal <= in->size + map->choose_local_fallback_tries) | 424 | flocal <= in->size + map->choose_local_fallback_tries) |
422 | /* exhaustive bucket search */ | 425 | /* exhaustive bucket search */ |
423 | retry_bucket = 1; | 426 | retry_bucket = 1; |
424 | else if (ftotal <= map->choose_total_tries) | 427 | else if (ftotal <= attempts) |
425 | /* then retry descent */ | 428 | /* then retry descent */ |
426 | retry_descent = 1; | 429 | retry_descent = 1; |
427 | else | 430 | else |
@@ -634,7 +637,8 @@ int crush_do_rule(const struct crush_map *map, | |||
634 | __u32 step; | 637 | __u32 step; |
635 | int i, j; | 638 | int i, j; |
636 | int numrep; | 639 | int numrep; |
637 | int choose_leaf_tries = 1; | 640 | int choose_tries = map->choose_total_tries; |
641 | int choose_leaf_tries = 0; | ||
638 | const int descend_once = 0; | 642 | const int descend_once = 0; |
639 | 643 | ||
640 | if ((__u32)ruleno >= map->max_rules) { | 644 | if ((__u32)ruleno >= map->max_rules) { |
@@ -701,6 +705,8 @@ int crush_do_rule(const struct crush_map *map, | |||
701 | x, numrep, | 705 | x, numrep, |
702 | curstep->arg2, | 706 | curstep->arg2, |
703 | o+osize, j, | 707 | o+osize, j, |
708 | choose_tries, | ||
709 | choose_leaf_tries ? choose_leaf_tries : choose_tries, | ||
704 | recurse_to_leaf, | 710 | recurse_to_leaf, |
705 | descend_once, c+osize); | 711 | descend_once, c+osize); |
706 | } else { | 712 | } else { |
@@ -711,8 +717,8 @@ int crush_do_rule(const struct crush_map *map, | |||
711 | x, numrep, numrep, | 717 | x, numrep, numrep, |
712 | curstep->arg2, | 718 | curstep->arg2, |
713 | o+osize, j, | 719 | o+osize, j, |
714 | map->choose_total_tries, | 720 | choose_tries, |
715 | choose_leaf_tries, | 721 | choose_leaf_tries ? choose_leaf_tries : 1, |
716 | recurse_to_leaf, | 722 | recurse_to_leaf, |
717 | c+osize, | 723 | c+osize, |
718 | 0); | 724 | 0); |