mirror of
https://github.com/ceph/ceph
synced 2025-03-06 16:28:28 +00:00
Merge pull request #15319 from liewegas/wip-upmap
mon,osd/OSDMap: a couple pg-upmap fixes Reviewed-by: Josh Durgin <jdurgin@redhat.com>
This commit is contained in:
commit
420dd7ff02
@ -7870,11 +7870,6 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
|
||||
err = -EINVAL;
|
||||
goto reply;
|
||||
}
|
||||
if (!osdmap.pg_exists(pgid)) {
|
||||
ss << "pg " << pgid << " does not exist";
|
||||
err = -ENOENT;
|
||||
goto reply;
|
||||
}
|
||||
if (pending_inc.new_pg_upmap.count(pgid) ||
|
||||
pending_inc.old_pg_upmap.count(pgid)) {
|
||||
dout(10) << __func__ << " waiting for pending update on " << pgid << dendl;
|
||||
@ -7990,11 +7985,6 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
|
||||
err = -EINVAL;
|
||||
goto reply;
|
||||
}
|
||||
if (!osdmap.pg_exists(pgid)) {
|
||||
ss << "pg " << pgid << " does not exist";
|
||||
err = -ENOENT;
|
||||
goto reply;
|
||||
}
|
||||
if (pending_inc.new_pg_upmap_items.count(pgid) ||
|
||||
pending_inc.old_pg_upmap_items.count(pgid)) {
|
||||
dout(10) << __func__ << " waiting for pending update on " << pgid << dendl;
|
||||
|
@ -3512,6 +3512,8 @@ int OSDMap::calc_pg_upmaps(
|
||||
}
|
||||
OSDMap tmp;
|
||||
tmp.deepish_copy_from(*this);
|
||||
float start_deviation = 0;
|
||||
float end_deviation = 0;
|
||||
int num_changed = 0;
|
||||
while (true) {
|
||||
map<int,set<pg_t>> pgs_by_osd;
|
||||
@ -3559,6 +3561,7 @@ int OSDMap::calc_pg_upmaps(
|
||||
ldout(cct, 10) << " pgs_per_weight " << pgs_per_weight << dendl;
|
||||
|
||||
// osd deviation
|
||||
float total_deviation = 0;
|
||||
map<int,float> osd_deviation; // osd, deviation(pgs)
|
||||
multimap<float,int> deviation_osd; // deviation(pgs), osd
|
||||
set<int> overfull;
|
||||
@ -3574,7 +3577,12 @@ int OSDMap::calc_pg_upmaps(
|
||||
deviation_osd.insert(make_pair(deviation, i.first));
|
||||
if (deviation >= 1.0)
|
||||
overfull.insert(i.first);
|
||||
total_deviation += abs(deviation);
|
||||
}
|
||||
if (num_changed == 0) {
|
||||
start_deviation = total_deviation;
|
||||
}
|
||||
end_deviation = total_deviation;
|
||||
|
||||
// build underfull, sorted from least-full to most-average
|
||||
vector<int> underfull;
|
||||
@ -3585,7 +3593,8 @@ int OSDMap::calc_pg_upmaps(
|
||||
break;
|
||||
underfull.push_back(i->second);
|
||||
}
|
||||
ldout(cct, 10) << " overfull " << overfull
|
||||
ldout(cct, 10) << " total_deviation " << total_deviation
|
||||
<< " overfull " << overfull
|
||||
<< " underfull " << underfull << dendl;
|
||||
if (overfull.empty() || underfull.empty())
|
||||
break;
|
||||
@ -3673,5 +3682,7 @@ int OSDMap::calc_pg_upmaps(
|
||||
break;
|
||||
}
|
||||
}
|
||||
ldout(cct, 10) << " start deviation " << start_deviation << dendl;
|
||||
ldout(cct, 10) << " end deviation " << end_deviation << dendl;
|
||||
return num_changed;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user