Skip to content

Commit

Permalink
Merge pull request #13164 from dzafman/wip-18718
Browse files Browse the repository at this point in the history
osd: Fix useless MAX(0, unsigned) to prevent out of wack misplaced

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
dzafman committed Jan 31, 2017
2 parents 573a832 + fff2b63 commit f63871c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/osd/PG.cc
Expand Up @@ -2518,7 +2518,7 @@ void PG::_update_calc_stats()
// in acting and not in up Compute misplaced objects excluding num_missing
// in up and not in acting Compute total objects already backfilled
if (in_acting) {
int osd_missing;
unsigned osd_missing;
// primary handling
if (p == pg_whoami) {
osd_missing = pg_log.get_missing().num_missing();
Expand All @@ -2532,8 +2532,8 @@ void PG::_update_calc_stats()
}
missing += osd_missing;
// Count non-missing objects not in up as misplaced
if (!in_up)
misplaced += MAX(0, num_objects - osd_missing);
if (!in_up && num_objects > osd_missing)
misplaced += num_objects - osd_missing;
} else {
assert(in_up && !in_acting);

Expand Down

0 comments on commit f63871c

Please sign in to comment.