Skip to content

Commit

Permalink
Merge pull request #9006 from athanatos/wip-15655-jewel
Browse files Browse the repository at this point in the history
OSDMonitor: avoid underflow in reweight-by-utilization if max_change=1

Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed May 9, 2016
2 parents 030883f + 0de6345 commit fdf8dcb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mon/OSDMonitor.cc
Expand Up @@ -624,7 +624,8 @@ int OSDMonitor::reweight_by_utilization(int oload,
// to represent e.g. differing storage capacities
unsigned weight = osdmap.get_weight(p->first);
unsigned new_weight = (unsigned)((average_util / util) * (float)weight);
new_weight = MAX(new_weight, weight - max_change);
if (weight > max_change)
new_weight = MAX(new_weight, weight - max_change);
newinc.new_weight[p->first] = new_weight;
if (!dry_run) {
pending_inc.new_weight[p->first] = new_weight;
Expand Down

0 comments on commit fdf8dcb

Please sign in to comment.