]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: move duplicated inner loop out 37428/head
authorZhi Zhang <willzzhang@tencent.com>
Sun, 27 Sep 2020 10:42:56 +0000 (18:42 +0800)
committerZhi Zhang <willzzhang@tencent.com>
Tue, 1 Dec 2020 03:06:17 +0000 (11:06 +0800)
Signed-off-by: Zhi Zhang <zhangz.david@outlook.com>
src/mds/MDCache.cc

index f45d18f9b874b1abbc0118c34e852ac7f6e5f861..6fb2812bf5882fb00b5007c05060c3239a69ff23 100644 (file)
@@ -11019,6 +11019,11 @@ int MDCache::send_dir_updates(CDir *dir, bool bcast)
   filepath path;
   dir->inode->make_path(path);
 
+  std::set<int32_t> dir_rep_set;
+  for (const auto &r : dir->dir_rep_by) {
+    dir_rep_set.insert(r);
+  }
+
   mds_rank_t whoami = mds->get_nodeid();
   for (set<mds_rank_t>::iterator it = who.begin();
        it != who.end();
@@ -11027,11 +11032,7 @@ int MDCache::send_dir_updates(CDir *dir, bool bcast)
     //if (*it == except) continue;
     dout(7) << "sending dir_update on " << *dir << " to " << *it << dendl;
 
-    std::set<int32_t> s;
-    for (const auto &r : dir->dir_rep_by) {
-      s.insert(r);
-    }
-    mds->send_message_mds(make_message<MDirUpdate>(mds->get_nodeid(), dir->dirfrag(), dir->dir_rep, s, path, bcast), *it);
+    mds->send_message_mds(make_message<MDirUpdate>(mds->get_nodeid(), dir->dirfrag(), dir->dir_rep, dir_rep_set, path, bcast), *it);
   }
 
   return 0;