From: Sage Weil Date: Tue, 3 Jun 2008 16:54:55 +0000 (-0700) Subject: mds: rip out autoscatter nonsense X-Git-Tag: v0.3~170^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0dfca47035e513503685d465627a86353aa08e50;p=ceph.git mds: rip out autoscatter nonsense --- diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 0bd4efbf76d7c..f7ff78a560bd4 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -2346,20 +2346,8 @@ void Locker::scatter_eval(ScatterLock *lock) if (lock->get_parent()->is_frozen()) return; CInode *in = (CInode*)lock->get_parent(); - if (in->has_subtree_root_dirfrag() && !in->is_base()) { - // i _should_ be scattered. - /* - if (!lock->is_rdlocked() && - !lock->is_xlocked() && - lock->get_state() != LOCK_SCATTER) { - dout(10) << "scatter_eval no rdlocks|xlocks, am subtree root inode, scattering" << dendl; - scatter_scatter(lock); - autoscattered.push_back(&lock->xlistitem_autoscattered); - } - */ - } else { + if (!in->has_subtree_root_dirfrag() || in->is_base()) { // i _should_ be sync. - lock->xlistitem_autoscattered.remove_myself(); if (!lock->is_wrlocked() && !lock->is_xlocked() && lock->get_state() != LOCK_SYNC) { @@ -2369,12 +2357,6 @@ void Locker::scatter_eval(ScatterLock *lock) } } -void Locker::note_autoscattered(ScatterLock *lock) -{ - dout(10) << "note_autoscattered " << *lock << " on " << *lock->get_parent() << dendl; - autoscattered.push_back(&lock->xlistitem_autoscattered); -} - /* * mark a scatterlock to indicate that the dir fnode has some dirty data @@ -2403,11 +2385,22 @@ void Locker::mark_updated_scatterlock(ScatterLock *lock) */ void Locker::scatter_nudge(ScatterLock *lock, Context *c) { - MDSCacheObject *p = lock->get_parent(); + CInode *p = (CInode *)lock->get_parent(); + + if (p->is_frozen() || p->is_freezing()) { + dout(10) << "scatter_nudge waiting for unfreeze on " << *p << dendl; + if (c) + p->add_waiter(MDSCacheObject::WAIT_UNFREEZE, c); + return; + } + if (p->is_ambiguous_auth()) { dout(10) << "scatter_nudge waiting for single auth on " << *p << dendl; p->add_waiter(MDSCacheObject::WAIT_SINGLEAUTH, c); - } else if (p->is_auth()) { + return; + } + + if (p->is_auth()) { dout(10) << "scatter_nudge auth, scatter/unscattering " << *lock << " on " << *p << dendl; if (c) lock->add_waiter(SimpleLock::WAIT_STABLE, c); @@ -2441,43 +2434,8 @@ void Locker::scatter_tick() { dout(10) << "scatter_tick" << dendl; - /* - * periodically unscatter autoscattered locks - */ - utime_t now = g_clock.now(); - int n = autoscattered.size(); - while (!autoscattered.empty()) { - ScatterLock *lock = autoscattered.front(); - - // stop? - if (lock->get_parent()->is_auth() && - lock->get_state() == LOCK_SCATTER && - now - lock->get_last_scatter() < 10.0) - break; - - autoscattered.pop_front(); - - if (!lock->get_parent()->is_auth()) - continue; - - if (lock->get_state() == LOCK_SCATTER && - lock->get_parent()->is_replicated()) { - if (((CInode*)lock->get_parent())->is_frozen() || - ((CInode*)lock->get_parent())->is_freezing()) { - // hrm.. requeue. - dout(10) << "last_scatter " << lock->get_last_scatter() - << ", now " << now << ", but frozen|freezing, requeueing" << dendl; - autoscattered.push_back(&lock->xlistitem_autoscattered); - } else { - dout(10) << "last_scatter " << lock->get_last_scatter() - << ", now " << now << ", locking" << dendl; - scatter_lock(lock); - } - } - if (--n == 0) break; - } - // updated + utime_t now = g_clock.now(); while (!updated_scatterlocks.empty()) { ScatterLock *lock = updated_scatterlocks.front(); diff --git a/src/mds/Locker.h b/src/mds/Locker.h index b7f6cf9080157..13b278b582e70 100644 --- a/src/mds/Locker.h +++ b/src/mds/Locker.h @@ -121,17 +121,12 @@ public: void dentry_anon_rdlock_trace_finish(vector& trace); // scatter -protected: - xlist autoscattered; - public: void try_scatter_eval(ScatterLock *lock); void scatter_eval(ScatterLock *lock); // public for MDCache::adjust_subtree_auth() void scatter_eval_gather(ScatterLock *lock); void scatter_tick(); - void note_autoscattered(ScatterLock *lock); - void scatter_nudge(ScatterLock *lock, Context *c); protected: diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index b3bd3e2b36d4d..2fdde5c45c7b3 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -2004,14 +2004,11 @@ void Migrator::decode_import_inode(CDentry *dn, bufferlist::iterator& blp, int o // clear if dirtyscattered, since we're going to journal this // but not until we _actually_ finish the import... - if (in->dirlock.is_updated()) + if (in->dirlock.is_updated()) { updated_scatterlocks.push_back(&in->dirlock); + mds->locker->mark_updated_scatterlock(&in->dirlock); + } - // put in autoscatter list? - // this is conservative, but safe. - if (in->dirlock.get_state() == LOCK_SCATTER) - mds->locker->note_autoscattered(&in->dirlock); - // adjust replica list //assert(!in->is_replica(oldauth)); // not true on failed export in->add_replica(oldauth, CInode::EXPORT_NONCE); diff --git a/src/mds/ScatterLock.h b/src/mds/ScatterLock.h index 4c8ad48e7e1a5..3eddcd9656e22 100644 --- a/src/mds/ScatterLock.h +++ b/src/mds/ScatterLock.h @@ -68,7 +68,6 @@ class ScatterLock : public SimpleLock { utime_t last_scatter; public: - xlist::item xlistitem_autoscattered; xlist::item xlistitem_updated; utime_t update_stamp; @@ -76,7 +75,6 @@ public: SimpleLock(o, t, wo), num_wrlock(0), updated(false), - xlistitem_autoscattered(this), xlistitem_updated(this) {} int get_replica_state() {