aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorIlya Dryomov <ilya.dryomov@inktank.com>2013-12-24 14:19:26 -0500
committerIlya Dryomov <ilya.dryomov@inktank.com>2013-12-31 13:32:22 -0500
commitf18650ace38ef200dd1578257c75e9407297953c (patch)
tree252f8675255569d1ab376b652cbb3c17332f36ca /net/ceph
parentbe3226acc5544bcc91e756eb3ee6ca7b74f6f0a8 (diff)
crush: apply chooseleaf_tries to firstn mode too
Parameterize the attempts for the _firstn choose method, and apply the rule-specified tries count to firstn mode as well. Note that we have slightly different behavior here than with indep: If the firstn value is not specified for firstn, we pass through the normal attempt count. This maintains compatibility with legacy behavior. Note that this is usually *not* actually N^2 work, though, because of the descend_once tunable. However, descend_once is unfortunately *not* the same thing as 1 chooseleaf try because it is only checked on a reject but not on a collision. Sigh. In contrast, for indep, if tries is not specified we default to 1 recursive attempt, because that is simply more sane, and we have the option to do so. The descend_once tunable has no effect for indep. Reflects ceph.git commit 64aeded50d80942d66a5ec7b604ff2fcbf5d7b63. Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/crush/mapper.c14
1 files changed, 10 insertions, 4 deletions
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);