]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/MDBalancer: redundance cleanup
authorhuanwen ren <ren.huanwen@zte.com.cn>
Fri, 29 Jul 2016 05:55:57 +0000 (13:55 +0800)
committerhuanwen ren <ren.huanwen@zte.com.cn>
Wed, 3 Aug 2016 01:19:51 +0000 (09:19 +0800)
Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
src/mds/MDBalancer.cc

index dcca7956069c74ff1525f56b4073c034d8658ac1..782f98873e986603e1f81bd8b93c9214d7f9a7a2 100644 (file)
@@ -554,40 +554,36 @@ void MDBalancer::prep_rebalance(int beat)
       }
     }
 
-
-    if (1) {
-      if (beat % 2 == 1) {
-       // old way
-       dout(15) << "  matching big exporters to big importers" << dendl;
-       // big exporters to big importers
-       multimap<double,mds_rank_t>::reverse_iterator ex = exporters.rbegin();
-       multimap<double,mds_rank_t>::iterator im = importers.begin();
-       while (ex != exporters.rend() &&
-              im != importers.end()) {
-         double maxex = get_maxex(ex->second);
-         double maxim = get_maxim(im->second);
-         if (maxex < .001 || maxim < .001) break;
-         try_match(ex->second, maxex,
-                   im->second, maxim);
-         if (maxex <= .001) ++ex;
-         if (maxim <= .001) ++im;
-       }
-      } else {
-       // new way
-       dout(15) << "  matching small exporters to big importers" << dendl;
-       // small exporters to big importers
-       multimap<double,mds_rank_t>::iterator ex = exporters.begin();
-       multimap<double,mds_rank_t>::iterator im = importers.begin();
-       while (ex != exporters.end() &&
-              im != importers.end()) {
-         double maxex = get_maxex(ex->second);
-         double maxim = get_maxim(im->second);
-         if (maxex < .001 || maxim < .001) break;
-         try_match(ex->second, maxex,
-                   im->second, maxim);
-         if (maxex <= .001) ++ex;
-         if (maxim <= .001) ++im;
-       }
+    // old way
+    if (beat % 2 == 1) {
+      dout(15) << "  matching big exporters to big importers" << dendl;
+      // big exporters to big importers
+      multimap<double,mds_rank_t>::reverse_iterator ex = exporters.rbegin();
+      multimap<double,mds_rank_t>::iterator im = importers.begin();
+      while (ex != exporters.rend() &&
+            im != importers.end()) {
+        double maxex = get_maxex(ex->second);
+       double maxim = get_maxim(im->second);
+       if (maxex < .001 || maxim < .001) break;
+       try_match(ex->second, maxex,
+                 im->second, maxim);
+       if (maxex <= .001) ++ex;
+       if (maxim <= .001) ++im;
+      }
+    } else { // new way
+      dout(15) << "  matching small exporters to big importers" << dendl;
+      // small exporters to big importers
+      multimap<double,mds_rank_t>::iterator ex = exporters.begin();
+      multimap<double,mds_rank_t>::iterator im = importers.begin();
+      while (ex != exporters.end() &&
+            im != importers.end()) {
+        double maxex = get_maxex(ex->second);
+       double maxim = get_maxim(im->second);
+       if (maxex < .001 || maxim < .001) break;
+       try_match(ex->second, maxex,
+                 im->second, maxim);
+       if (maxex <= .001) ++ex;
+       if (maxim <= .001) ++im;
       }
     }
   }
@@ -938,43 +934,12 @@ void MDBalancer::hit_inode(utime_t now, CInode *in, int type, int who)
   if (in->get_parent_dn())
     hit_dir(now, in->get_parent_dn()->get_dir(), type, who);
 }
-/*
-  // hit me
-  in->popularity[MDS_POP_JUSTME].pop[type].hit(now);
-  in->popularity[MDS_POP_NESTED].pop[type].hit(now);
-  if (in->is_auth()) {
-    in->popularity[MDS_POP_CURDOM].pop[type].hit(now);
-    in->popularity[MDS_POP_ANYDOM].pop[type].hit(now);
-
-    dout(20) << "hit_inode " << type << " pop "
-            << in->popularity[MDS_POP_JUSTME].pop[type].get(now) << " me, "
-            << in->popularity[MDS_POP_NESTED].pop[type].get(now) << " nested, "
-            << in->popularity[MDS_POP_CURDOM].pop[type].get(now) << " curdom, "
-            << in->popularity[MDS_POP_CURDOM].pop[type].get(now) << " anydom"
-            << " on " << *in
-            << dendl;
-  } else {
-    dout(20) << "hit_inode " << type << " pop "
-            << in->popularity[MDS_POP_JUSTME].pop[type].get(now) << " me, "
-            << in->popularity[MDS_POP_NESTED].pop[type].get(now) << " nested, "
-            << " on " << *in
-            << dendl;
-  }
-
-  // hit auth up to import
-  CDir *dir = in->get_parent_dir();
-  if (dir) hit_dir(now, dir, type);
-*/
-
 
 void MDBalancer::hit_dir(utime_t now, CDir *dir, int type, int who, double amount)
 {
   // hit me
   double v = dir->pop_me.get(type).hit(now, amount);
 
-  //if (dir->ino() == inodeno_t(0x10000000000))
-  //dout(0) << "hit_dir " << type << " pop " << v << " in " << *dir << dendl;
-
   // split/merge
   if (g_conf->mds_bal_frag && g_conf->mds_bal_fragment_interval > 0 &&
       !dir->inode->is_base() &&        // not root/base (for now at least)