]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: avoid going to MIX when unnecessary
authorSage Weil <sage@newdream.net>
Mon, 30 Mar 2009 20:30:39 +0000 (13:30 -0700)
committerSage Weil <sage@newdream.net>
Mon, 30 Mar 2009 20:30:39 +0000 (13:30 -0700)
src/mds/CInode.h
src/mds/Locker.cc

index 50fd794edc6bb34163f5aead234a76e9f70e4e7c..a567860d5383cafb3d74cc8e849a7d84190e01e7 100644 (file)
@@ -549,6 +549,19 @@ public:
        n++;
     return n;
   }
+  bool multiple_nonstale_caps() {
+    int n = 0;
+    for (map<int,Capability*>::iterator it = client_caps.begin();
+         it != client_caps.end();
+         it++) 
+      if (!it->second->is_stale()) {
+       if (n)
+         return true;
+       n++;
+      }
+    return false;
+
+  }
   int get_loner() {
     return loner_cap;
   }
index 858c39b258575fbd783c80a418f82c98709b4cf4..eb6e3e755fba31b44c301db4c1748efe3a2869c1 100644 (file)
@@ -1539,6 +1539,8 @@ void Locker::handle_client_caps(MClientCaps *m)
       eval_cap_gather(in);
       if (in->filelock.is_stable())
        file_eval(&in->filelock);
+      if (in->authlock.is_stable())
+       eval(&in->authlock);
     }
 
     // done?
@@ -2870,7 +2872,7 @@ void Locker::file_eval(ScatterLock *lock)
           //!lock->is_rdlocked() &&
           //!lock->is_waiter_for(SimpleLock::WAIT_WR) &&
           (lock->get_scatter_wanted() ||
-           (wanted & (CEPH_CAP_GRD|CEPH_CAP_GWR)))) {
+           (in->multiple_nonstale_caps() && (wanted & (CEPH_CAP_GRD|CEPH_CAP_GWR))))) {
     dout(7) << "file_eval stable, bump to mixed " << *lock
            << " on " << *lock->get_parent() << dendl;
     file_mixed(lock);