diff options
author | Ilya Dryomov <ilya.dryomov@inktank.com> | 2013-12-24 14:19:27 -0500 |
---|---|---|
committer | Ilya Dryomov <ilya.dryomov@inktank.com> | 2013-12-31 13:32:26 -0500 |
commit | f046bf92080cbdc4a94c6e86698c5a3f10716445 (patch) | |
tree | 1ce6610a200c82bc3229aebfca48bc2a2f5e0cec /net | |
parent | d390bb2a83086f2b79c152e2c1734813bd257d9b (diff) |
crush: add set_choose_local_[fallback_]tries steps
This allows all of the tunables to be overridden by a specific rule.
Reflects ceph.git commits d129e09e57fbc61cfd4f492e3ee77d0750c9d292,
0497db49e5973b50df26251ed0e3f4ac7578e66e.
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ceph/crush/mapper.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c index 0613dd2d5fa3..8cde4818e18b 100644 --- a/net/ceph/crush/mapper.c +++ b/net/ceph/crush/mapper.c | |||
@@ -300,6 +300,8 @@ static int crush_choose_firstn(const struct crush_map *map, | |||
300 | int *out, int outpos, | 300 | int *out, int outpos, |
301 | unsigned int attempts, | 301 | unsigned int attempts, |
302 | unsigned int recurse_attempts, | 302 | unsigned int recurse_attempts, |
303 | unsigned int local_tries, | ||
304 | unsigned int local_fallback_tries, | ||
303 | int recurse_to_leaf, | 305 | int recurse_to_leaf, |
304 | int *out2) | 306 | int *out2) |
305 | { | 307 | { |
@@ -338,9 +340,9 @@ static int crush_choose_firstn(const struct crush_map *map, | |||
338 | reject = 1; | 340 | reject = 1; |
339 | goto reject; | 341 | goto reject; |
340 | } | 342 | } |
341 | if (map->choose_local_fallback_tries > 0 && | 343 | if (local_fallback_tries > 0 && |
342 | flocal >= (in->size>>1) && | 344 | flocal >= (in->size>>1) && |
343 | flocal > map->choose_local_fallback_tries) | 345 | flocal > local_fallback_tries) |
344 | item = bucket_perm_choose(in, x, r); | 346 | item = bucket_perm_choose(in, x, r); |
345 | else | 347 | else |
346 | item = crush_bucket_choose(in, x, r); | 348 | item = crush_bucket_choose(in, x, r); |
@@ -387,6 +389,8 @@ static int crush_choose_firstn(const struct crush_map *map, | |||
387 | x, outpos+1, 0, | 389 | x, outpos+1, 0, |
388 | out2, outpos, | 390 | out2, outpos, |
389 | recurse_attempts, 0, | 391 | recurse_attempts, 0, |
392 | local_tries, | ||
393 | local_fallback_tries, | ||
390 | 0, | 394 | 0, |
391 | NULL) <= outpos) | 395 | NULL) <= outpos) |
392 | /* didn't get leaf */ | 396 | /* didn't get leaf */ |
@@ -412,11 +416,11 @@ reject: | |||
412 | ftotal++; | 416 | ftotal++; |
413 | flocal++; | 417 | flocal++; |
414 | 418 | ||
415 | if (collide && flocal <= map->choose_local_tries) | 419 | if (collide && flocal <= local_tries) |
416 | /* retry locally a few times */ | 420 | /* retry locally a few times */ |
417 | retry_bucket = 1; | 421 | retry_bucket = 1; |
418 | else if (map->choose_local_fallback_tries > 0 && | 422 | else if (local_fallback_tries > 0 && |
419 | flocal <= in->size + map->choose_local_fallback_tries) | 423 | flocal <= in->size + local_fallback_tries) |
420 | /* exhaustive bucket search */ | 424 | /* exhaustive bucket search */ |
421 | retry_bucket = 1; | 425 | retry_bucket = 1; |
422 | else if (ftotal <= attempts) | 426 | else if (ftotal <= attempts) |
@@ -633,6 +637,8 @@ int crush_do_rule(const struct crush_map *map, | |||
633 | int i, j; | 637 | int i, j; |
634 | int numrep; | 638 | int numrep; |
635 | int choose_tries = map->choose_total_tries; | 639 | int choose_tries = map->choose_total_tries; |
640 | int choose_local_tries = map->choose_local_tries; | ||
641 | int choose_local_fallback_tries = map->choose_local_fallback_tries; | ||
636 | int choose_leaf_tries = 0; | 642 | int choose_leaf_tries = 0; |
637 | 643 | ||
638 | if ((__u32)ruleno >= map->max_rules) { | 644 | if ((__u32)ruleno >= map->max_rules) { |
@@ -665,6 +671,16 @@ int crush_do_rule(const struct crush_map *map, | |||
665 | choose_leaf_tries = curstep->arg1; | 671 | choose_leaf_tries = curstep->arg1; |
666 | break; | 672 | break; |
667 | 673 | ||
674 | case CRUSH_RULE_SET_CHOOSE_LOCAL_TRIES: | ||
675 | if (curstep->arg1 > 0) | ||
676 | choose_local_tries = curstep->arg1; | ||
677 | break; | ||
678 | |||
679 | case CRUSH_RULE_SET_CHOOSE_LOCAL_FALLBACK_TRIES: | ||
680 | if (curstep->arg1 > 0) | ||
681 | choose_local_fallback_tries = curstep->arg1; | ||
682 | break; | ||
683 | |||
668 | case CRUSH_RULE_CHOOSELEAF_FIRSTN: | 684 | case CRUSH_RULE_CHOOSELEAF_FIRSTN: |
669 | case CRUSH_RULE_CHOOSE_FIRSTN: | 685 | case CRUSH_RULE_CHOOSE_FIRSTN: |
670 | firstn = 1; | 686 | firstn = 1; |
@@ -714,6 +730,8 @@ int crush_do_rule(const struct crush_map *map, | |||
714 | o+osize, j, | 730 | o+osize, j, |
715 | choose_tries, | 731 | choose_tries, |
716 | recurse_tries, | 732 | recurse_tries, |
733 | choose_local_tries, | ||
734 | choose_local_fallback_tries, | ||
717 | recurse_to_leaf, | 735 | recurse_to_leaf, |
718 | c+osize); | 736 | c+osize); |
719 | } else { | 737 | } else { |