From: David Zafman Date: Fri, 27 Jan 2017 22:42:37 +0000 (-0800) Subject: osd: Fix useless MAX(0, unsigned) to prevent out of wack misplaced X-Git-Tag: v12.0.0~47^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fff2b63d24f6582f082b38dd53de2995a9a061cf;p=ceph.git osd: Fix useless MAX(0, unsigned) to prevent out of wack misplaced Still want to prevent strange results if for some reason num_objects is less than osd_missing. Fixes: http://tracker.ceph.com/issues/18718 Signed-off-by: David Zafman --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index c373ef1ac20e..e4fa77bb6e0c 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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(); @@ -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);