} else if (prefix == "osd tree") {
if (f) {
f->open_object_section("tree");
- p->print_tree(NULL, f.get());
+ p->print_tree(f.get(), NULL);
f->close_section();
f->flush(ds);
} else {
- p->print_tree(&ds, NULL);
+ p->print_tree(NULL, &ds);
}
rdata.append(ds);
} else if (prefix == "osd getmap") {
const OSDMap *osdmap;
};
-void OSDMap::print_tree(ostream *out, Formatter *f) const
+void OSDMap::print_tree(Formatter *f, ostream *out) const
{
- if (out) {
+ if (f)
+ OSDTreeFormattingDumper(crush.get(), this).dump(f);
+ else {
+ assert(out);
TextTable tbl;
OSDTreePlainDumper(crush.get(), this).dump(&tbl);
*out << tbl;
}
- if (f)
- OSDTreeFormattingDumper(crush.get(), this).dump(f);
}
void OSDMap::print_summary(Formatter *f, ostream& out) const
void print_pools(ostream& out) const;
void print_summary(Formatter *f, ostream& out) const;
void print_oneline_summary(ostream& out) const;
- void print_tree(ostream *out, Formatter *f) const;
+ void print_tree(Formatter *f, ostream *out) const;
string get_flag_string() const;
static string get_flag_string(unsigned flags);
if (tree) {
if (tree_formatter) {
tree_formatter->open_object_section("tree");
- osdmap.print_tree(NULL, tree_formatter.get());
+ osdmap.print_tree(tree_formatter.get(), NULL);
tree_formatter->close_section();
tree_formatter->flush(cout);
cout << std::endl;
} else {
- osdmap.print_tree(&cout, NULL);
+ osdmap.print_tree(NULL, &cout);
}
}
if (modified) {