Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crush: builder: creating crush map with optimal configurations #14209

Merged
merged 1 commit into from Apr 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 33 additions & 11 deletions src/crush/builder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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));
}
3 changes: 3 additions & 0 deletions src/crush/builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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