From: Sage Weil Date: Wed, 12 Jul 2017 22:26:51 +0000 (-0400) Subject: crush/CrushTreeDumper: include parent in Item X-Git-Tag: v12.1.2~150^2~33 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=673c114e260c62aa907b998f0e5b12d043d69960;p=ceph.git crush/CrushTreeDumper: include parent in Item This gives us info we need for the weight_sets... Signed-off-by: Sage Weil --- diff --git a/src/crush/CrushTester.cc b/src/crush/CrushTester.cc index ac58c882feb9..da0d2a51c896 100644 --- a/src/crush/CrushTester.cc +++ b/src/crush/CrushTester.cc @@ -416,7 +416,7 @@ bool CrushTester::check_name_maps(unsigned max_id) const // 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; diff --git a/src/crush/CrushTreeDumper.h b/src/crush/CrushTreeDumper.h index ca5a93fce783..2c927998f527 100644 --- a/src/crush/CrushTreeDumper.h +++ b/src/crush/CrushTreeDumper.h @@ -50,12 +50,13 @@ namespace CrushTreeDumper { struct Item { int id; + int parent; int depth; float weight; list 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; } }; @@ -103,7 +104,7 @@ namespace CrushTreeDumper { ++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; } @@ -118,7 +119,7 @@ namespace CrushTreeDumper { 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))); } } diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 91eddd6cdf0a..79afc4299db6 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -2222,7 +2222,7 @@ namespace { set roots; crush->find_roots(roots); for (set::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); } } @@ -2246,7 +2246,7 @@ namespace { 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(); } diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 7d2939e100a5..d404253ca706 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -3081,7 +3081,7 @@ public: 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); } } } @@ -3153,7 +3153,7 @@ public: 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(); } @@ -3957,7 +3957,7 @@ protected: 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); } }