From 3dcd4eaf867369437720a21daf3c344cc4b9844e Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Wed, 20 Jun 2018 09:27:46 +0800 Subject: [PATCH] osd/OSDMap.cc: move sanity checks to the proper place Signed-off-by: xie xingguo --- src/osd/OSDMap.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 798b7fa1e296e..67bb651ec63d9 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -4222,6 +4222,8 @@ int OSDMap::calc_pg_upmaps( multimap deviation_osd; // deviation(pgs), osd set overfull; for (auto& i : pgs_by_osd) { + // make sure osd is still there (belongs to this crush-tree) + assert(osd_weight.count(i.first)); float target = osd_weight[i.first] * pgs_per_weight; float deviation = (float)i.second.size() - target; ldout(cct, 20) << " osd." << i.first @@ -4260,8 +4262,6 @@ int OSDMap::calc_pg_upmaps( for (auto p = deviation_osd.rbegin(); p != deviation_osd.rend(); ++p) { int osd = p->second; float deviation = p->first; - // make sure osd is still there (belongs to this crush-tree) - assert(osd_weight.count(osd)); float target = osd_weight[osd] * pgs_per_weight; assert(target > 0); if (deviation/target < max_deviation_ratio) { -- 2.39.5