public:
typedef CrushTreeDumper::Dumper<ostream> Parent;
- CrushTreePlainDumper(const CrushWrapper *crush, const vector<__u32>& w)
- : Parent(crush), weights(w) {}
+ CrushTreePlainDumper(const CrushWrapper *crush)
+ : Parent(crush) {}
void dump(ostream *out) {
- *out << "ID\tWEIGHT\tTYPE NAME\tREWEIGHT\n";
+ *out << "ID\tWEIGHT\tTYPE NAME\n";
Parent::dump(out);
}
}
else
{
- assert(qi.id >= 0 && (size_t)qi.id < weights.size());
- *out << "osd." << qi.id << "\t"
- << weightf_t((double)weights[qi.id] / (double)0x10000) << "\t";
+ *out << "osd." << qi.id;
}
*out << "\n";
}
-
-private:
- const vector<__u32>& weights;
};
public:
typedef CrushTreeDumper::FormattingDumper Parent;
- CrushTreeFormattingDumper(const CrushWrapper *crush, const vector<__u32>& w)
- : Parent(crush), weights(w) {}
+ CrushTreeFormattingDumper(const CrushWrapper *crush)
+ : Parent(crush) {}
void dump(Formatter *f) {
f->open_array_section("nodes");
f->open_array_section("stray");
f->close_section();
}
-
-protected:
- virtual void dump_item_fields(const CrushTreeDumper::Item &qi, Formatter *f) {
- CrushTreeFormattingDumper::dump_item_fields(qi, f);
- if (!qi.is_bucket())
- {
- assert(qi.id >= 0 && (size_t)qi.id < weights.size());
- f->dump_float("reweight", (double)weights[qi.id] / (double)0x10000);
- }
- }
-
-private:
- const vector<__u32>& weights;
};
-void CrushWrapper::dump_tree(const vector<__u32>& w, ostream *out, Formatter *f) const
+void CrushWrapper::dump_tree(ostream *out, Formatter *f) const
{
if (out)
- CrushTreePlainDumper(this, w).dump(out);
+ CrushTreePlainDumper(this).dump(out);
if (f)
- CrushTreeFormattingDumper(this, w).dump(f);
+ CrushTreeFormattingDumper(this).dump(f);
}
void CrushWrapper::generate_test_instances(list<CrushWrapper*>& o)
void dump_rule(int ruleset, Formatter *f) const;
void dump_tunables(Formatter *f) const;
void list_rules(Formatter *f) const;
- void dump_tree(const vector<__u32>& w, ostream *out, Formatter *f) const;
+ void dump_tree(ostream *out, Formatter *f) const;
static void generate_test_instances(list<CrushWrapper*>& o);
int get_osd_pool_default_crush_replicated_ruleset(CephContext *cct);
TEST(CRUSH, indep_toosmall) {
CrushWrapper *c = build_indep_map(g_ceph_context, 1, 3, 1);
vector<__u32> weight(c->get_max_devices(), 0x10000);
- c->dump_tree(weight, &cout, NULL);
+ c->dump_tree(&cout, NULL);
for (int x = 0; x < 100; ++x) {
vector<int> out;
TEST(CRUSH, indep_basic) {
CrushWrapper *c = build_indep_map(g_ceph_context, 3, 3, 3);
vector<__u32> weight(c->get_max_devices(), 0x10000);
- c->dump_tree(weight, &cout, NULL);
+ c->dump_tree(&cout, NULL);
for (int x = 0; x < 100; ++x) {
vector<int> out;
int num = 3*3*3;
for (int i=0; i<num / 2; ++i)
weight[i*2] = 0;
- c->dump_tree(weight, &cout, NULL);
+ c->dump_tree(&cout, NULL);
// need more retries to get 9/9 hosts for x in 0..99
c->set_choose_total_tries(100);
int num = 3*3*3;
for (int i=0; i<num / 3; ++i)
weight[i] = 0;
- c->dump_tree(weight, &cout, NULL);
+ c->dump_tree(&cout, NULL);
c->set_choose_total_tries(100);
for (int x = 0; x < 100; ++x) {
CrushWrapper *c = build_indep_map(g_ceph_context, 3, 3, 3);
c->set_choose_total_tries(100);
vector<__u32> tweight(c->get_max_devices(), 0x10000);
- c->dump_tree(tweight, &cout, NULL);
+ c->dump_tree(&cout, NULL);
int tchanged = 0;
for (int x = 1; x < 5; ++x) {