From: Sahid Orentino Ferdjaoui Date: Tue, 28 Mar 2017 14:16:43 +0000 (-0400) Subject: crush: builder: creating crush map with optimal configurations X-Git-Tag: v12.0.2~128^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=855d207a85110e344e05e9c31c9d3f6105a2dbbd;p=ceph.git crush: builder: creating crush map with optimal configurations In this commit we update the behavior of crush_create(...) to return a crush_map initialized with optimal configurations. We also provide a function set_legacy_crush_map(...) to allow users comming back to the legacy configurations. Signed-off-by: Sahid Orentino Ferdjaoui --- diff --git a/src/crush/builder.c b/src/crush/builder.c index 37c6d86ac03..04b88cac1b8 100644 --- a/src/crush/builder.c +++ b/src/crush/builder.c @@ -23,17 +23,7 @@ struct crush_map *crush_create() return NULL; memset(m, 0, sizeof(*m)); - /* initialize legacy tunable values */ - m->choose_local_tries = 2; - m->choose_local_fallback_tries = 5; - m->choose_total_tries = 19; - m->chooseleaf_descend_once = 0; - m->chooseleaf_vary_r = 0; - m->straw_calc_version = 0; - - // by default, use legacy types, and also exclude tree, - // since it was buggy. - m->allowed_bucket_algs = CRUSH_LEGACY_ALLOWED_BUCKET_ALGS; + set_optimal_crush_map(m); return m; } @@ -1425,3 +1415,35 @@ int crush_multiplication_is_unsafe(__u32 a, __u32 b) else return 0; } + +/***************************/ + +/* methods to configure crush_map */ + +void set_legacy_crush_map(struct crush_map *map) { + /* initialize legacy tunable values */ + map->choose_local_tries = 2; + map->choose_local_fallback_tries = 5; + map->choose_total_tries = 19; + map->chooseleaf_descend_once = 0; + map->chooseleaf_vary_r = 0; + map->straw_calc_version = 0; + + // by default, use legacy types, and also exclude tree, + // since it was buggy. + map->allowed_bucket_algs = CRUSH_LEGACY_ALLOWED_BUCKET_ALGS; +} + +void set_optimal_crush_map(struct crush_map *map) { + map->choose_local_tries = 0; + map->choose_local_fallback_tries = 0; + map->choose_total_tries = 50; + map->chooseleaf_descend_once = 1; + map->chooseleaf_vary_r = 1; + map->chooseleaf_stable = 1; + map->allowed_bucket_algs = ( + (1 << CRUSH_BUCKET_UNIFORM) | + (1 << CRUSH_BUCKET_LIST) | + (1 << CRUSH_BUCKET_STRAW) | + (1 << CRUSH_BUCKET_STRAW2)); +} diff --git a/src/crush/builder.h b/src/crush/builder.h index 67381fdd652..54320d8221d 100644 --- a/src/crush/builder.h +++ b/src/crush/builder.h @@ -303,4 +303,7 @@ crush_make_straw_bucket(struct crush_map *map, extern int crush_addition_is_unsafe(__u32 a, __u32 b); extern int crush_multiplication_is_unsafe(__u32 a, __u32 b); +extern void set_legacy_crush_map(struct crush_map *map); +extern void set_optimal_crush_map(struct crush_map *map); + #endif