]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: move redundant pg_temp check to remove_down_temps
authorSage Weil <sage@redhat.com>
Wed, 11 May 2016 17:27:47 +0000 (13:27 -0400)
committerSage Weil <sage@redhat.com>
Thu, 12 May 2016 13:59:30 +0000 (09:59 -0400)
Better to do this on the future map value.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSDMap.cc

index 5a481e20c57b103770a9a524873ae6847e694bd0..4bb9a13398d37478eb1c4afab1092f522ad20ea9 100644 (file)
@@ -1179,20 +1179,6 @@ void OSDMap::remove_redundant_temporaries(CephContext *cct, const OSDMap& osdmap
                                          OSDMap::Incremental *pending_inc)
 {
   ldout(cct, 10) << "remove_redundant_temporaries" << dendl;
-
-  for (map<pg_t,vector<int32_t> >::iterator p = osdmap.pg_temp->begin();
-       p != osdmap.pg_temp->end();
-       ++p) {
-    if (pending_inc->new_pg_temp.count(p->first) == 0) {
-      vector<int> raw_up;
-      int primary;
-      osdmap.pg_to_raw_up(p->first, &raw_up, &primary);
-      if (raw_up == p->second) {
-        ldout(cct, 10) << " removing unnecessary pg_temp " << p->first << " -> " << p->second << dendl;
-        pending_inc->new_pg_temp[p->first].clear();
-      }
-    }
-  }
   if (!osdmap.primary_temp->empty()) {
     OSDMap templess;
     templess.deepish_copy_from(osdmap);
@@ -1249,6 +1235,18 @@ void OSDMap::remove_down_temps(CephContext *cct,
       pending_inc->new_pg_temp[p->first].clear();
       continue;
     }
+    // redundant pg_temp?
+    if (pending_inc->new_pg_temp.count(p->first) == 0) {
+      vector<int> raw_up;
+      int primary;
+      tmpmap.pg_to_raw_up(p->first, &raw_up, &primary);
+      if (raw_up == p->second) {
+        ldout(cct, 10) << __func__ << "  removing pg_temp " << p->first << " "
+                      << p->second << " that matches raw_up mapping" << 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();