]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: rip out autoscatter nonsense
authorSage Weil <sage@newdream.net>
Tue, 3 Jun 2008 16:54:55 +0000 (09:54 -0700)
committerSage Weil <sage@newdream.net>
Tue, 3 Jun 2008 16:54:55 +0000 (09:54 -0700)
src/mds/Locker.cc
src/mds/Locker.h
src/mds/Migrator.cc
src/mds/ScatterLock.h

index 0bd4efbf76d7c49a68479f0191a39d9ebe845cd4..f7ff78a560bd450269157accf5f49a7dca9e0951 100644 (file)
@@ -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();
     
index b7f6cf9080157f321c911863ca14cc2587f7e48d..13b278b582e708d9ac2580b7c2b6dea7e50429ec 100644 (file)
@@ -121,17 +121,12 @@ public:
   void dentry_anon_rdlock_trace_finish(vector<CDentry*>& trace);
 
   // scatter
-protected:
-  xlist<ScatterLock*> 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:
index b3bd3e2b36d4d3d75b8a12353cdfedc8f505e2a4..2fdde5c45c7b3da259c30382d338c2720325f946 100644 (file)
@@ -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);
index 4c8ad48e7e1a5cab34238e9869e28fc35d0192ac..3eddcd9656e22fde804ce8aa0ca1f61051679712 100644 (file)
@@ -68,7 +68,6 @@ class ScatterLock : public SimpleLock {
   utime_t last_scatter;
 
 public:
-  xlist<ScatterLock*>::item xlistitem_autoscattered;
   xlist<ScatterLock*>::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() {