From cce471c48b340e618109f19643f8a797377feafe Mon Sep 17 00:00:00 2001 From: sage Date: Wed, 1 Mar 2006 19:51:41 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@714 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/mds/CInode.cc | 2 ++ ceph/mds/MDBalancer.cc | 14 +++++++++----- ceph/mds/MDCache.cc | 4 +++- ceph/mds/MDS.cc | 22 ++++++++++++++++++++++ 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/ceph/mds/CInode.cc b/ceph/mds/CInode.cc index e58764d62e378..c4c3b20642041 100644 --- a/ceph/mds/CInode.cc +++ b/ceph/mds/CInode.cc @@ -480,6 +480,8 @@ int CInode::authority() { CInodeDiscover* CInode::replicate_to( int rep ) { + assert(is_auth()); + // relax locks? if (!is_cached_by_anyone()) replicate_relax_locks(); diff --git a/ceph/mds/MDBalancer.cc b/ceph/mds/MDBalancer.cc index dcb294197685b..ec8ce9fd46c5a 100644 --- a/ceph/mds/MDBalancer.cc +++ b/ceph/mds/MDBalancer.cc @@ -533,7 +533,7 @@ void MDBalancer::find_exports(CDir *dir, double dir_pop = dir->popularity[MDS_POP_CURDOM].meta_load(); double dir_sum = 0; - dout(7) << " find_exports in " << dir_pop << " " << *dir << " need " << need << " (" << needmin << " - " << needmax << ")" << endl; + dout(-7) << " find_exports in " << dir_pop << " " << *dir << " need " << need << " (" << needmin << " - " << needmax << ")" << endl; for (CDir_map_t::iterator it = dir->begin(); it != dir->end(); @@ -653,16 +653,20 @@ void MDBalancer::hit_dir(CDir *dir, int type) // hit modify counter, if this was a modify if (g_conf.num_mds > 2 && // FIXME >2 thing - dir->is_auth() && - !dir->inode->is_root()) { // not root (for now at least) + !dir->inode->is_root() && // not root (for now at least) + dir->is_auth()) { + //dout(-20) << "hit_dir " << type << " pop is " << v << " " << *dir << endl; + // hash this dir? (later?) if (((v > g_conf.mds_bal_hash_rd && type == META_POP_IRD) || - (v > g_conf.mds_bal_hash_wr && type == META_POP_IWR)) && + //(v > g_conf.mds_bal_hash_wr && type == META_POP_IWR) || + (v > g_conf.mds_bal_hash_wr && type == META_POP_DWR)) && !(dir->is_hashed() || dir->is_hashing()) && hash_queue.count(dir->ino()) == 0) { dout(0) << "hit_dir " << type << " pop is " << v << ", putting in hash_queue: " << *dir << endl; hash_queue.insert(dir->ino()); } + } hit_recursive(dir, type); @@ -790,7 +794,7 @@ void MDBalancer::add_import(CDir *dir) void MDBalancer::show_imports(bool external) { int db = 20; //debug level - + return; if (mds->mdcache->imports.empty() && mds->mdcache->hashdirs.empty()) { diff --git a/ceph/mds/MDCache.cc b/ceph/mds/MDCache.cc index 3c96234d874d2..477aaad04daa4 100644 --- a/ceph/mds/MDCache.cc +++ b/ceph/mds/MDCache.cc @@ -1332,7 +1332,9 @@ int MDCache::path_traverse(filepath& origpath, if (((MClientRequest*)req)->get_mds_wants_replica_in_dirino() == cur->dir->ino() && cur->dir->is_auth() && cur->dir->is_rep() && - cur->dir->is_open_by(req->get_source().num())) { + cur->dir->is_open_by(req->get_source().num()) && + dn->get_inode()->is_auth() + ) { assert(req->get_source().is_mds()); int from = req->get_source().num(); diff --git a/ceph/mds/MDS.cc b/ceph/mds/MDS.cc index bbf51ac0ea9ab..ea65983c75ae4 100644 --- a/ceph/mds/MDS.cc +++ b/ceph/mds/MDS.cc @@ -560,6 +560,17 @@ void MDS::my_dispatch(Message *m) finish_contexts(ls); } + // hash root? + if (false && + mdcache->get_root() && + mdcache->get_root()->dir && + !(mdcache->get_root()->dir->is_hashed() || + mdcache->get_root()->dir->is_hashing())) { + dout(0) << "hashing root" << endl; + mdcache->hash_dir(mdcache->get_root()->dir); + } + + // periodic crap (1-second resolution) static utime_t last_log = g_clock.recent_now(); utime_t now = g_clock.recent_now(); @@ -2589,6 +2600,17 @@ void MDS::handle_client_mkdir(MClientRequest *req, CInode *diri) balancer->hit_dir(newdir, META_POP_DWR); + if (diri->dir->is_auth() && + diri->dir->is_rep() && + newdir->is_auth() && + !newdir->is_hashing()) { + int dest = rand() % mdcluster->get_num_mds(); + if (dest != whoami) { + dout(-10) << "exporting new dir " << *newdir << " in replicated parent " << *diri->dir << endl; + mdcache->export_dir(newdir, dest); + } + } + // commit commit_request(req, new MClientReply(req, 0), diri, new EInodeUpdate(newi), -- 2.39.5