]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix rewewight_by_utilization
authorSage Weil <sage@newdream.net>
Wed, 30 May 2012 18:53:35 +0000 (11:53 -0700)
committerSage Weil <sage@newdream.net>
Wed, 30 May 2012 18:53:35 +0000 (11:53 -0700)
Update the incremental, not the in-memory OSDMap!

Fixes: #2454
Signed-off-by: Sage Weil <sage@newdream.net>
src/mon/OSDMonitor.cc

index 38f61a65655fb95b1b5be897a71b8d9a80bc542b..cfe710363ff81962a8198695fb9796d27aec2694 100644 (file)
@@ -326,12 +326,13 @@ int OSDMonitor::reweight_by_utilization(int oload, std::string& out_str)
       // Assign a lower weight to overloaded OSDs. The current weight
       // is a factor to take into account the original weights,
       // to represent e.g. differing storage capacities
-      float weight = osdmap.get_weightf(p->first);
-      float new_weight = (average_util / util) * weight;
-      osdmap.set_weightf(p->first, new_weight);
+      unsigned weight = osdmap.get_weight(p->first);
+      unsigned new_weight = (unsigned)((average_util / util) * (float)weight);
+      pending_inc.new_weight[p->first] = new_weight;
       char buf[128];
       snprintf(buf, sizeof(buf), "%d [%04f -> %04f]", p->first,
-              weight, new_weight);
+              (float)weight / (float)0x10000,
+              (float)new_weight / (float)0x10000);
       oss << buf << sep;
     }
   }