]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushWrapper: drop weights from crush dump_tree
authorSage Weil <sage@redhat.com>
Fri, 16 Jan 2015 21:20:05 +0000 (13:20 -0800)
committerSage Weil <sage@redhat.com>
Sat, 17 Jan 2015 16:58:40 +0000 (08:58 -0800)
Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/CrushWrapper.cc
src/crush/CrushWrapper.h
src/test/crush/crush.cc

index 954d8b210ea66a94b96726bdf5e9c0e0cfa350ed..8d9d21f0dc0cce4bd406df0f502fe82c88ce1576 100644 (file)
@@ -1491,11 +1491,11 @@ class CrushTreePlainDumper : public CrushTreeDumper::Dumper<ostream> {
 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);
   }
 
@@ -1514,15 +1514,10 @@ protected:
     }
     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;
 };
 
 
@@ -1530,8 +1525,8 @@ class CrushTreeFormattingDumper : public CrushTreeDumper::FormattingDumper {
 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");
@@ -1540,28 +1535,15 @@ public:
     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)
index 5e5330591e5d8c30ae3d7b5323b1029b25a81b3f..ae2fc5bcac1457bfe81fdb621dbbf8ed730c74b3 100644 (file)
@@ -1005,7 +1005,7 @@ public:
   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);
index d22e3f3e594a8770f1fc029f8f7566b80b7bbc2b..924647f51e977410bdfe6f333af0f911dbd7494a 100644 (file)
@@ -96,7 +96,7 @@ int get_num_dups(const vector<int>& v)
 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;
@@ -116,7 +116,7 @@ TEST(CRUSH, indep_toosmall) {
 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;
@@ -141,7 +141,7 @@ TEST(CRUSH, indep_out_alt) {
   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);
@@ -168,7 +168,7 @@ TEST(CRUSH, indep_out_contig) {
   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) {
@@ -191,7 +191,7 @@ TEST(CRUSH, indep_out_progressive) {
   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) {