]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: drop the interim set from load_pgs() 6277/head
authorPiotr Dałek <piotr.dalek@ts.fujitsu.com>
Thu, 15 Oct 2015 08:53:55 +0000 (10:53 +0200)
committerPiotr Dałek <piotr.dalek@ts.fujitsu.com>
Thu, 15 Oct 2015 08:53:55 +0000 (10:53 +0200)
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 <piotr.dalek@ts.fujitsu.com>
src/osd/OSD.cc

index a4af9981999424266fa57ad43e92efbf7c6102af..29ccc15726fc94d4757af7584e1e5df9b3429508 100644 (file)
@@ -2827,31 +2827,24 @@ void OSD::load_pgs()
     derr << "failed to list pgs: " << cpp_strerror(-r) << dendl;
   }
 
-  set<spg_t> pgs;
+  bool has_upgraded = false;
+
   for (vector<coll_t>::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<spg_t>::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