]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: minor optimization of remove_down_temps
authorSage Weil <sage@redhat.com>
Tue, 10 May 2016 14:09:56 +0000 (10:09 -0400)
committerSage Weil <sage@redhat.com>
Thu, 12 May 2016 13:59:29 +0000 (09:59 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSDMap.cc

index 124a1ab2364a4a3d29bd53c79d0c4d582030fe50..b64d4d79963cf5585eceef21f802650b2ec18268 100644 (file)
@@ -1235,15 +1235,20 @@ void OSDMap::remove_down_temps(CephContext *cct,
   for (map<pg_t,vector<int32_t> >::iterator p = tmpmap.pg_temp->begin();
        p != tmpmap.pg_temp->end();
        ++p) {
+    // all osds down?
     unsigned num_up = 0;
-    for (vector<int32_t>::iterator i = p->second.begin();
-        i != p->second.end();
-        ++i) {
-      if (!tmpmap.is_down(*i))
+    for (auto o : p->second) {
+      if (!tmpmap.is_down(o)) {
        ++num_up;
+       break;
+      }
     }
-    if (num_up == 0)
+    if (num_up == 0) {
+      ldout(cct, 10) << __func__ << "  removing pg_temp " << p->first
+                    << " with all down osds" << p->second << dendl;
       pending_inc->new_pg_temp[p->first].clear();
+      continue;
+    }
   }
   for (map<pg_t,int32_t>::iterator p = tmpmap.primary_temp->begin();
       p != tmpmap.primary_temp->end();