This gives us info we need for the weight_sets...
Signed-off-by: Sage Weil <sage@redhat.com>
// and see if the maps is also able to handle straying OSDs, whose id >= 0.
// "ceph osd tree" will try to print them, even they are not listed in the
// crush map.
- crush_walker.dump_item(CrushTreeDumper::Item(0, 0, 0), NULL);
+ crush_walker.dump_item(CrushTreeDumper::Item(0, 0, 0, 0), NULL);
} catch (const BadCrushMap& e) {
err << e.what() << ": item#" << e.item << std::endl;
return false;
struct Item {
int id;
+ int parent;
int depth;
float weight;
list<int> children;
- Item() : id(0), depth(0), weight(0) {}
- Item(int i, int d, float w) : id(i), depth(d), weight(w) {}
+ Item() : id(0), parent(0), depth(0), weight(0) {}
+ Item(int i, int p, int d, float w) : id(i), parent(p), depth(d), weight(w) {}
bool is_bucket() const { return id < 0; }
};
++root;
if (root == roots.end())
return false;
- push_back(Item(*root, 0, crush->get_bucket_weightf(*root)));
+ push_back(Item(*root, 0, 0, crush->get_bucket_weightf(*root)));
++root;
}
int id = crush->get_bucket_item(qi.id, k);
if (should_dump(id)) {
qi.children.push_back(id);
- push_front(Item(id, qi.depth + 1,
+ push_front(Item(id, qi.id, qi.depth + 1,
crush->get_bucket_item_weightf(qi.id, k)));
}
}
set<int> roots;
crush->find_roots(roots);
for (set<int>::iterator root = roots.begin(); root != roots.end(); ++root) {
- dump_item(Item(*root, 0, crush->get_bucket_weightf(*root)), f);
+ dump_item(Item(*root, 0, 0, crush->get_bucket_weightf(*root)), f);
}
}
for (int pos = 0; pos < max_pos; pos++) {
int id = crush->get_bucket_item(parent.id, pos);
float weight = crush->get_bucket_item_weightf(parent.id, pos);
- dump_item(Item(id, parent.depth + 1, weight), f);
+ dump_item(Item(id, parent.id, parent.depth + 1, weight), f);
}
f->close_section();
}
for (int i = 0; i < osdmap->get_max_osd(); i++) {
if (osdmap->exists(i) && !is_touched(i) && should_dump_leaf(i)) {
- dump_item(CrushTreeDumper::Item(i, 0, 0), tbl);
+ dump_item(CrushTreeDumper::Item(i, 0, 0, 0), tbl);
}
}
}
f->open_array_section("stray");
for (int i = 0; i < osdmap->get_max_osd(); i++) {
if (osdmap->exists(i) && !is_touched(i) && should_dump_leaf(i))
- dump_item(CrushTreeDumper::Item(i, 0, 0), f);
+ dump_item(CrushTreeDumper::Item(i, 0, 0, 0), f);
}
f->close_section();
}
void dump_stray(F *f) {
for (int i = 0; i < osdmap->get_max_osd(); i++) {
if (osdmap->exists(i) && !this->is_touched(i))
- dump_item(CrushTreeDumper::Item(i, 0, 0), f);
+ dump_item(CrushTreeDumper::Item(i, 0, 0, 0), f);
}
}