From: David Zafman Date: Wed, 27 Nov 2019 18:48:30 +0000 (-0800) Subject: osd: ceph_pg_upmaps() use any overfull when there are still underfull X-Git-Tag: v13.2.9~112^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bbb09be05cc3b0f452ad49ce77199060a3eb774d;p=ceph.git osd: ceph_pg_upmaps() use any overfull when there are still underfull Signed-off-by: David Zafman (cherry picked from commit f38d38398f33f64bd49f017b1c8e737452157c53) --- diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 48d8d0c2557a..2f85efa5a877 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -4258,19 +4258,21 @@ int OSDMap::calc_pg_upmaps( ldout(cct, 30) << "Top of loop #" << max+1 << dendl; // build overfull and underfull set overfull; + set more_overfull; + bool using_more_overfull = false; vector underfull; vector more_underfull; for (auto i = deviation_osd.rbegin(); i != deviation_osd.rend(); i++) { ldout(cct, 30) << " check " << i->first << " <= " << max_deviation << dendl; - if (i->first <= max_deviation) + if (i->first <= 0) break; - ldout(cct, 30) << " add overfull osd." << i->second << dendl; - overfull.insert(i->second); + if (i->first > max_deviation) { + ldout(cct, 30) << " add overfull osd." << i->second << dendl; + overfull.insert(i->second); + } else { + more_overfull.insert(i->second); + } } - if (overfull.empty()) { - ldout(cct, 20) << __func__ << " failed to build overfull" << dendl; - break; - } for (auto i = deviation_osd.begin(); i != deviation_osd.end(); i++) { ldout(cct, 30) << " check " << i->first << " >= " << -(int)max_deviation << dendl; @@ -4283,10 +4285,15 @@ int OSDMap::calc_pg_upmaps( more_underfull.push_back(i->second); } } - if (underfull.empty() && more_underfull.empty()) { - ldout(cct, 20) << __func__ << " failed to build underfull and more_underfull" << dendl; + if (underfull.empty() && overfull.empty()) { + ldout(cct, 20) << __func__ << " failed to build overfull and underfull" << dendl; break; } + if (overfull.empty() && !underfull.empty()) { + ldout(cct, 20) << __func__ << " Using more_overfull since we still have underfull" << dendl; + overfull = more_overfull; + using_more_overfull = true; + } ldout(cct, 10) << " overfull " << overfull << " underfull " << underfull @@ -4313,7 +4320,7 @@ int OSDMap::calc_pg_upmaps( << " deviation " << deviation << dendl; ceph_assert(target > 0); - if (deviation <= max_deviation) { + if (!using_more_overfull && deviation <= max_deviation) { ldout(cct, 10) << " osd." << osd << " target " << target << " deviation " << deviation