From: huanwen ren Date: Fri, 29 Jul 2016 05:55:57 +0000 (+0800) Subject: mds/MDBalancer: redundance cleanup X-Git-Tag: ses5-milestone5~216^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7905f31d5eae7de957cece6dd3a9fd71ac52da61;p=ceph.git mds/MDBalancer: redundance cleanup Signed-off-by: huanwen ren --- diff --git a/src/mds/MDBalancer.cc b/src/mds/MDBalancer.cc index dcca7956069c..782f98873e98 100644 --- a/src/mds/MDBalancer.cc +++ b/src/mds/MDBalancer.cc @@ -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::reverse_iterator ex = exporters.rbegin(); - multimap::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::iterator ex = exporters.begin(); - multimap::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::reverse_iterator ex = exporters.rbegin(); + multimap::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::iterator ex = exporters.begin(); + multimap::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)