]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: simplify prime_pg_temp slightly
authorSage Weil <sage@redhat.com>
Mon, 30 Jan 2017 22:30:14 +0000 (17:30 -0500)
committerSage Weil <sage@redhat.com>
Thu, 16 Feb 2017 17:04:07 +0000 (12:04 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc

index 0628574b7a39a81a466a5f9eff6e05677562938d..90551038c23ada7cc4ee188e8c2dd7386d90f967 100644 (file)
@@ -1068,29 +1068,28 @@ void OSDMonitor::prime_pg_temp(
   // do not touch a mapping if a change is pending
   if (pending_inc.new_pg_temp.count(pgid))
     return;
-  vector<int> old_acting;
-  mapping->get(pgid, nullptr, nullptr, &old_acting, nullptr);
+
   vector<int> up, acting;
-  int up_primary, acting_primary;
-  next.pg_to_up_acting_osds(pgid, &up, &up_primary, &acting, &acting_primary);
-  if (acting == old_acting)
-    return;  // no change since last pg update, skip
-  vector<int> cur_up, cur_acting;
-  osdmap.pg_to_up_acting_osds(pgid, &cur_up, &up_primary,
-                             &cur_acting, &acting_primary);
-  if (cur_acting == acting)
-    return;  // no change this epoch; must be stale pg_stat
-  if (cur_acting.empty())
+  mapping->get(pgid, &up, nullptr, &acting, nullptr);
+
+  vector<int> next_up, next_acting;
+  int next_up_primary, next_acting_primary;
+  next.pg_to_up_acting_osds(pgid, &next_up, &next_up_primary,
+                           &next_acting, &next_acting_primary);
+  if (acting == next_acting)
+    return;  // no change since last epoch
+
+  if (acting.empty())
     return;  // if previously empty now we can be no worse off
   const pg_pool_t *pool = next.get_pg_pool(pgid.pool());
-  if (pool && cur_acting.size() < pool->min_size)
+  if (pool && acting.size() < pool->min_size)
     return;  // can be no worse off than before
 
-  dout(20) << __func__ << " " << pgid << " " << cur_up << "/" << cur_acting
-          << " -> " << up << "/" << acting
-          << ", priming " << cur_acting
+  dout(20) << __func__ << " " << pgid << " " << up << "/" << acting
+          << " -> " << next_up << "/" << next_acting
+          << ", priming " << acting
           << dendl;
-  pending_inc.new_pg_temp[pgid] = cur_acting;
+  pending_inc.new_pg_temp[pgid] = acting;
 }
 
 /**