Merge pull request #15313 from Linbing/wip-pg-scrub-code-optimize

mon: it's no need to get pg action_primary osd twice in pg scrub

Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Sage Weil 2017-05-29 20:42:50 -05:00 committed by GitHub
commit 43a58ec2a2

View File

@ -990,12 +990,12 @@ bool PGMonitor::preprocess_command(MonOpRequestRef op)
r = -ENOENT;
goto reply;
}
if (pg_map.pg_stat[pgid].acting_primary == -1) {
int osd = pg_map.pg_stat[pgid].acting_primary;
if (osd == -1) {
ss << "pg " << pgid << " has no primary osd";
r = -EAGAIN;
goto reply;
}
int osd = pg_map.pg_stat[pgid].acting_primary;
if (!mon->osdmon()->osdmap.is_up(osd)) {
ss << "pg " << pgid << " primary osd." << osd << " not up";
r = -EAGAIN;