From f9c44ef81c02b1bd72c7c58513ac5eeb7296cf6c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Piotr=20Da=C5=82ek?= Date: Thu, 15 Oct 2015 10:53:55 +0200 Subject: [PATCH] osd: drop the interim set from load_pgs() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit During execution of load_pgs(), all PGs are added to interim set and then processed again from the beginning. Discard this extra loop and entire interim set, saving a bit of memory and CPU time (by better utilization of L1/L2 caches). Signed-off-by: Piotr Dałek --- src/osd/OSD.cc | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index a4af99819994..29ccc15726fc 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2827,31 +2827,24 @@ void OSD::load_pgs() derr << "failed to list pgs: " << cpp_strerror(-r) << dendl; } - set pgs; + bool has_upgraded = false; + for (vector::iterator it = ls.begin(); it != ls.end(); ++it) { spg_t pgid; - if (it->is_temp(&pgid) || - it->is_removal(&pgid) || - (it->is_pg(&pgid) && PG::_has_removal_flag(store, pgid))) { + if (it->is_temp(&pgid) || it->is_removal(&pgid) || + (it->is_pg(&pgid) && PG::_has_removal_flag(store, pgid))) { dout(10) << "load_pgs " << *it << " clearing temp" << dendl; recursive_remove_collection(store, pgid, *it); continue; } - if (it->is_pg(&pgid)) { - pgs.insert(pgid); + if (!it->is_pg(&pgid)) { + dout(10) << "load_pgs ignoring unrecognized " << *it << dendl; continue; } - dout(10) << "load_pgs ignoring unrecognized " << *it << dendl; - } - - bool has_upgraded = false; - for (set::iterator i = pgs.begin(); i != pgs.end(); ++i) { - spg_t pgid(*i); - if (pgid.preferred() >= 0) { dout(10) << __func__ << ": skipping localized PG " << pgid << dendl; // FIXME: delete it too, eventually -- 2.47.3