]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush, osdmap: use weightf_t helper for all weights
authorSage Weil <sage@redhat.com>
Fri, 16 Jan 2015 19:05:13 +0000 (11:05 -0800)
committerSage Weil <sage@redhat.com>
Sat, 17 Jan 2015 16:57:26 +0000 (08:57 -0800)
Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/CrushWrapper.cc
src/osd/OSDMap.cc

index 5b76fc02858aaa84c2fd1654910631c65f533309..bef044043471a40e4d06d26636aadace5746b839 100644 (file)
@@ -1501,10 +1501,8 @@ public:
 
 protected:
   virtual void dump_item(const CrushTreeDumper::Item &qi, ostream *out) {
-    std::streamsize p = out->precision();
-
     *out << qi.id << "\t"
-        << std::setprecision(4) << qi.weight << "\t";
+        << weightf_t(qi.weight) << "\t";
 
     for (int k=0; k < qi.depth; k++)
       *out << "\t";
@@ -1518,9 +1516,9 @@ protected:
     {
       assert(qi.id >= 0 && (size_t)qi.id < weights.size());
       *out << "osd." << qi.id << "\t"
-          << (double)weights[qi.id] / (double)0x10000 << "\t";
+          << weightf_t((double)weights[qi.id] / (double)0x10000) << "\t";
     }
-    *out << std::setprecision(p) << "\n";
+    *out << "\n";
   }
 
 private:
index 7cc896a5be958a95c3fdd3ed60b7468f9e26d3e8..c956b731f729cfc12f1aeb37fb3526fdcd504c4b 100644 (file)
@@ -2475,7 +2475,7 @@ protected:
   virtual void dump_item(const CrushTreeDumper::Item &qi, TextTable *tbl) {
 
     *tbl << qi.id
-        << stringify(weightf_t(qi.weight));
+        << weightf_t(qi.weight);
 
     ostringstream name;
     for (int k = 0; k < qi.depth; k++)
@@ -2494,8 +2494,8 @@ protected:
             << 0;
       } else {
        *tbl << (osdmap->is_up(qi.id) ? "up" : "down")
-            << stringify(weightf_t(osdmap->get_weightf(qi.id)))
-            << osdmap->get_primary_affinityf(qi.id);
+            << weightf_t(osdmap->get_weightf(qi.id))
+            << weightf_t(osdmap->get_primary_affinityf(qi.id));
       }
     }
     *tbl << TextTable::endrow;