out << "tunable chooseleaf_descend_once " << crush.get_chooseleaf_descend_once() << "\n";
if (crush.get_chooseleaf_vary_r() != 0)
out << "tunable chooseleaf_vary_r " << crush.get_chooseleaf_vary_r() << "\n";
+ if (crush.get_straw_calc_version() != 0)
+ out << "tunable straw_calc_version " << crush.get_straw_calc_version() << "\n";
out << "\n# devices\n";
for (int i=0; i<crush.get_max_devices(); i++) {
crush.set_chooseleaf_descend_once(val);
else if (name == "chooseleaf_vary_r")
crush.set_chooseleaf_vary_r(val);
+ else if (name == "straw_calc_version")
+ crush.set_straw_calc_version(val);
else {
err << "tunable " << name << " not recognized" << std::endl;
return -1;
::encode(crush->choose_total_tries, bl);
::encode(crush->chooseleaf_descend_once, bl);
::encode(crush->chooseleaf_vary_r, bl);
+ ::encode(crush->straw_calc_version, bl);
}
static void decode_32_or_64_string_map(map<int32_t,string>& m, bufferlist::iterator& blp)
if (!blp.end()) {
::decode(crush->chooseleaf_vary_r, blp);
}
+ if (!blp.end()) {
+ ::decode(crush->straw_calc_version, blp);
+ }
finalize();
}
catch (...) {
f->dump_int("choose_total_tries", get_choose_total_tries());
f->dump_int("chooseleaf_descend_once", get_chooseleaf_descend_once());
f->dump_int("chooseleaf_vary_r", get_chooseleaf_vary_r());
+ f->dump_int("straw_calc_version", get_straw_calc_version());
// be helpful about it
if (has_firefly_tunables())
crush->choose_total_tries = 19;
crush->chooseleaf_descend_once = 0;
crush->chooseleaf_vary_r = 0;
+ crush->straw_calc_version = 0;
}
void set_tunables_bobtail() {
crush->choose_local_tries = 0;
crush->choose_total_tries = 50;
crush->chooseleaf_descend_once = 1;
crush->chooseleaf_vary_r = 0;
+ crush->straw_calc_version = 0;
}
void set_tunables_firefly() {
crush->choose_local_tries = 0;
crush->choose_total_tries = 50;
crush->chooseleaf_descend_once = 1;
crush->chooseleaf_vary_r = 1;
+ crush->straw_calc_version = 0;
}
void set_tunables_legacy() {
crush->chooseleaf_vary_r = n;
}
+ int get_straw_calc_version() const {
+ return crush->straw_calc_version;
+ }
+ void set_straw_calc_version(int n) {
+ crush->straw_calc_version = n;
+ }
+
bool has_argonaut_tunables() const {
return
crush->choose_local_tries == 2 &&
crush->choose_local_fallback_tries == 5 &&
crush->choose_total_tries == 19 &&
crush->chooseleaf_descend_once == 0 &&
- crush->chooseleaf_vary_r == 0;
+ crush->chooseleaf_vary_r == 0 &&
+ crush->straw_calc_version == 0;
}
bool has_bobtail_tunables() const {
return
crush->choose_local_fallback_tries == 0 &&
crush->choose_total_tries == 50 &&
crush->chooseleaf_descend_once == 1 &&
- crush->chooseleaf_vary_r == 0;
+ crush->chooseleaf_vary_r == 0 &&
+ crush->straw_calc_version == 0;
}
bool has_firefly_tunables() const {
return
crush->choose_local_fallback_tries == 0 &&
crush->choose_total_tries == 50 &&
crush->chooseleaf_descend_once == 1 &&
- crush->chooseleaf_vary_r == 1;
+ crush->chooseleaf_vary_r == 1 &&
+ crush->straw_calc_version == 0;
}
bool has_optimal_tunables() const {
m->choose_total_tries = 19;
m->chooseleaf_descend_once = 0;
m->chooseleaf_vary_r = 0;
+ m->straw_calc_version = 0;
return m;
}
* mappings line up a bit better with previous mappings. */
__u8 chooseleaf_vary_r;
+ /*
+ * version 0 (original) of straw_calc has various flaws. version 1
+ * fixes a few of them.
+ */
+ __u8 straw_calc_version;
+
__u32 *choose_tries;
};
int choose_total_tries = -1;
int chooseleaf_descend_once = -1;
int chooseleaf_vary_r = -1;
+ int straw_calc_version = -1;
CrushWrapper crush;
} else if (ceph_argparse_withint(args, i, &chooseleaf_vary_r, &err,
"--set_chooseleaf_vary_r", (char*)NULL)) {
adjust = true;
+ } else if (ceph_argparse_withint(args, i, &straw_calc_version, &err,
+ "--set_straw_calc_version", (char*)NULL)) {
+ adjust = true;
} else if (ceph_argparse_flag(args, i, "--reweight", (char*)NULL)) {
reweight = true;
} else if (ceph_argparse_withint(args, i, &add_item, &err, "--add_item", (char*)NULL)) {
crush.set_chooseleaf_vary_r(chooseleaf_vary_r);
modified = true;
}
+ if (straw_calc_version >= 0) {
+ crush.set_straw_calc_version(straw_calc_version);
+ modified = true;
+ }
if (modified) {
crush.finalize();