From: xie xingguo Date: Mon, 9 Oct 2017 07:53:53 +0000 (+0800) Subject: osd/PG: avoid updating missing_loc_sources multiple times X-Git-Tag: v13.0.1~572^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b650e915195d59cf080cc0e9b0944d9772a0d2d7;p=ceph.git osd/PG: avoid updating missing_loc_sources multiple times Signed-off-by: xie xingguo --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 3adc0660e341..89c895e0d676 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -598,6 +598,7 @@ void PG::MissingLoc::add_batch_sources_info( ldout(pg->cct, 10) << __func__ << ": adding sources in batch " << sources.size() << dendl; unsigned loop = 0; + bool sources_updated = false; for (map::const_iterator i = needs_recovery_map.begin(); i != needs_recovery_map.end(); ++i) { @@ -608,7 +609,10 @@ void PG::MissingLoc::add_batch_sources_info( if (i->second.is_delete()) continue; missing_loc[i->first].insert(sources.begin(), sources.end()); - missing_loc_sources.insert(sources.begin(), sources.end()); + if (!sources_updated) { + missing_loc_sources.insert(sources.begin(), sources.end()); + sources_updated = true; + } } } @@ -620,6 +624,7 @@ bool PG::MissingLoc::add_source_info( { bool found_missing = false; unsigned loop = 0; + bool sources_updated = false; // found items? for (map::const_iterator p = needs_recovery_map.begin(); p != needs_recovery_map.end(); @@ -673,7 +678,10 @@ bool PG::MissingLoc::add_source_info( << " is on osd." << fromosd << dendl; missing_loc[soid].insert(fromosd); - missing_loc_sources.insert(fromosd); + if (!sources_updated) { + missing_loc_sources.insert(fromosd); + sources_updated = true; + } found_missing = true; }