]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: builder: creating crush map with optimal configurations 14209/head
authorSahid Orentino Ferdjaoui <sahid.ferdjaoui@redhat.com>
Tue, 28 Mar 2017 14:16:43 +0000 (10:16 -0400)
committerLoic Dachary <ldachary@redhat.com>
Tue, 28 Mar 2017 21:33:17 +0000 (23:33 +0200)
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 <sahid.ferdjaoui@redhat.com>
src/crush/builder.c
src/crush/builder.h

index 37c6d86ac030c6fd20f74decc60a13e3b36e9f5f..04b88cac1b896d314dfcf707b730cfa27de06e71 100644 (file)
@@ -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));
+}
index 67381fdd65289ee3471d4043f149531173dd6738..54320d8221debda41012db7ee4a6f85a313aaab2 100644 (file)
@@ -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