]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushTreeDumper: include parent in Item
authorSage Weil <sage@redhat.com>
Wed, 12 Jul 2017 22:26:51 +0000 (18:26 -0400)
committerSage Weil <sage@redhat.com>
Fri, 21 Jul 2017 17:50:50 +0000 (13:50 -0400)
This gives us info we need for the weight_sets...

Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/CrushTester.cc
src/crush/CrushTreeDumper.h
src/crush/CrushWrapper.cc
src/osd/OSDMap.cc

index ac58c882feb900c5366f850cbc2bf6159ea501b3..da0d2a51c8961d72f2df0249b2ecd6e60dc886ab 100644 (file)
@@ -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;
index ca5a93fce783bc20cc0b7e3c6e4b6f966f8bd073..2c927998f527b17fda373825e12171a0913d10a1 100644 (file)
@@ -50,12 +50,13 @@ namespace CrushTreeDumper {
 
   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; }
   };
@@ -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)));
          }
        }
index 91eddd6cdf0aee354789b47f7db4827ff2b961fd..79afc4299db635647f8843c4e11f9b14561f7535 100644 (file)
@@ -2222,7 +2222,7 @@ namespace {
       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);
       }
     }
 
@@ -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();
     }
index 7d2939e100a595714414bbee64154ad6b336b423..d404253ca706c0c5b97e9cdbc32635a26e08762e 100644 (file)
@@ -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);
     }
   }