From: xie xingguo Date: Thu, 5 May 2016 08:19:06 +0000 (+0800) Subject: mon/OSDMonitor: avoid to reweight a currently out osd X-Git-Tag: v11.0.0~401^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=467bebb823f6f6e30bc003ea60b2819c5ef43350;p=ceph.git mon/OSDMonitor: avoid to reweight a currently out osd Signed-off-by: xie xingguo --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index e8e1fa778a58..3991c3c06d12 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -632,13 +632,17 @@ int OSDMonitor::reweight_by_utilization(int oload, util_by_osd.begin(); p != util_by_osd.end(); ++p) { + unsigned weight = osdmap.get_weight(p->first); + if (weight == 0) { + // skip if OSD is currently out + continue; + } float util = p->second; if (util >= overload_util) { // 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 - unsigned weight = osdmap.get_weight(p->first); unsigned new_weight = (unsigned)((average_util / util) * (float)weight); if (weight > max_change) new_weight = MAX(new_weight, weight - max_change); @@ -665,7 +669,6 @@ int OSDMonitor::reweight_by_utilization(int oload, } if (!no_increasing && util <= underload_util) { // assign a higher weight.. if we can. - unsigned weight = osdmap.get_weight(p->first); unsigned new_weight = (unsigned)((average_util / util) * (float)weight); new_weight = MIN(new_weight, weight + max_change); if (new_weight > 0x10000)