]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: reduce all_info map find to get primary 19425/head
authorkungf <yang.wang@easystack.cn>
Mon, 11 Dec 2017 03:00:18 +0000 (11:00 +0800)
committerkungf <yang.wang@easystack.cn>
Mon, 11 Dec 2017 03:00:18 +0000 (11:00 +0800)
Signed-off-by: kungf <yang.wang@easystack.cn>
src/osd/PG.cc

index 249d00548eabfb40933128934b698d9654734dee..7f652748c51748b718ad56344904904383ef790d 100644 (file)
@@ -1213,13 +1213,12 @@ void PG::calc_replicated_acting(
   pg_shard_t auth_log_shard_id = auth_log_shard->first;
   
   // select primary
-  map<pg_shard_t,pg_info_t>::const_iterator primary;
+  map<pg_shard_t,pg_info_t>::const_iterator primary = all_info.find(up_primary);
   if (up.size() &&
-      !all_info.find(up_primary)->second.is_incomplete() &&
-      all_info.find(up_primary)->second.last_update >=
+      !primary->second.is_incomplete() &&
+      primary->second.last_update >=
         auth_log_shard->second.log_tail) {
     ss << "up_primary: " << up_primary << ") selected as primary" << std::endl;
-    primary = all_info.find(up_primary); // prefer up[0], all thing being equal
   } else {
     assert(!auth_log_shard->second.is_incomplete());
     ss << "up[0] needs backfill, osd." << auth_log_shard_id