]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: journal open_files based on is_any_caps_wanted(), not is_any_caps()
authorSage Weil <sage@newdream.net>
Fri, 13 Nov 2009 23:06:31 +0000 (15:06 -0800)
committerSage Weil <sage@newdream.net>
Fri, 13 Nov 2009 23:21:32 +0000 (15:21 -0800)
Actually we're a bit conservative in a few places since the wanted check
is a bit more expensive.  We always do a full check in try_to_expire, so
much of the time we can do the quick check only.

src/mds/CInode.h
src/mds/Locker.cc
src/mds/MDCache.cc
src/mds/journal.cc

index 130ce23bbb7bf257ed6d2243c9d1aa038d4b39f5..17d45a463af9dfcae06335f5fe4d5dcab7885387 100644 (file)
@@ -775,6 +775,14 @@ public:
     if (pxlocker) *pxlocker = (xlocker >> shift) & mask;
     return (c >> shift) & mask;
   }
+  bool is_any_caps_wanted() {
+    for (map<client_t,Capability*>::iterator it = client_caps.begin();
+         it != client_caps.end();
+         it++)
+      if (it->second->wanted())
+       return true;
+    return false;
+  }
   int get_caps_wanted(int *ploner = 0, int *pother = 0, int shift = 0, int mask = 0xffff) {
     int w = 0;
     int loner = 0, other = 0;
index bb7ac65aab7f5cd19cc220aa352900c0bac7a4f6..ea35d05e3a946a96598dad43cfa99c09b8687f67 100644 (file)
@@ -1499,7 +1499,7 @@ bool Locker::check_inode_max_size(CInode *in, bool force_wrlock,
   // newer log segments.
   LogEvent *le;
   EMetaBlob *metablob;
-  if (in->is_any_caps()) {
+  if (in->is_any_caps_wanted()) {   
     EOpen *eo = new EOpen(mds->mdlog);
     eo->add_ino(in->ino());
     metablob = &eo->metablob;
@@ -1582,8 +1582,8 @@ void Locker::adjust_cap_wanted(Capability *cap, int wanted, int issue_seq)
   CInode *cur = cap->get_inode();
   if (cap->wanted() == 0) {
     if (cur->xlist_open_file.is_on_xlist() &&
-       cur->get_caps_wanted() == 0) {
-      dout(10) << " removing from open file list " << *cur << dendl;
+       !cur->is_any_caps_wanted()) {
+      dout(10) << " removing unwanted file from open file list " << *cur << dendl;
       cur->xlist_open_file.remove_myself();
     }
   } else {
index daf68038d8d17962e187d31fd566a26c442927bd..d7e21082a41d706be2086498e38361946ca63435 100644 (file)
@@ -4030,8 +4030,8 @@ void MDCache::clean_open_file_lists()
     while (!q.end()) {
       CInode *in = *q;
       ++q;
-      if (!in->is_any_caps()) {
-       dout(10) << " unlisting capless inode " << *in << dendl;
+      if (!in->is_any_caps_wanted()) {
+       dout(10) << " unlisting unwanted/capless inode " << *in << dendl;
        in->xlist_open_file.remove_myself();
       }
     }
index 6bb921a75cc73b501a221814d497a6f3633bf54c..3073a23e72d5400afc56bf7735cd7832ce0cf5c0 100644 (file)
@@ -163,7 +163,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
       CInode *in = *p;
       ++p;
       if (in->is_any_caps()) {
-       if (in->get_caps_wanted()) {
+       if (in->is_any_caps_wanted()) {
          dout(20) << "try_to_expire requeueing open file " << *in << dendl;
          if (!le) le = new EOpen(mds->mdlog);
          le->add_clean_inode(in);