]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: avoid touching dir utimes()'d mtime unless dirfrag mtime actually changes
authorSage Weil <sage@newdream.net>
Mon, 30 Jun 2008 22:36:11 +0000 (15:36 -0700)
committerSage Weil <sage@newdream.net>
Mon, 30 Jun 2008 22:36:11 +0000 (15:36 -0700)
src/TODO
src/mds/CInode.cc
src/mds/Locker.cc
src/mds/mdstypes.h

index d5359ace0bc63658891c33b28fb1b689369ad2c2..1e29b26354d1458e924410e82b4ca0bce8f67bdd 100644 (file)
--- a/src/TODO
+++ b/src/TODO
@@ -1,14 +1,6 @@
 v0.3
 
 v0.4
-- fill_trace locking
-  - revert 0772d6270c8a42b80323ecb2e43a844e28b7708a, then du during untar..
-  - we hit "Uhhuh" case in real_lookup().  the problem is the race
-    between lookup() adding a dentry and a subsequent revalidate always
-    failing.  
-  -> solution?  if htere is not dir ICONTENT or dentry lease, do not hash
-     the dentry in fill_trace... ?
-  - also, fill_trace should take dir->i_mutex... or not do the dentry update.
 - fix msgr protocol wrt resets, and varying connection close policies
 - ENOSPC
 - finish client failure recovery (reconnect after long eviction; and slow delayed reconnect)
index 95b0e6f52af74b75950f047739ca6aa653b2a549..d12101bc4d7338d2430aa746331d6375dbef3675 100644 (file)
@@ -743,6 +743,7 @@ void CInode::finish_scatter_gather_update(int type)
       // adjust summation
       assert(is_auth());
       inode_t *pi = get_projected_inode();
+      bool touched_mtime = false;
       dout(20) << "         orig dirstat " << pi->dirstat << dendl;
       for (map<frag_t,CDir*>::iterator p = dirfrags.begin();
           p != dirfrags.end();
@@ -753,13 +754,14 @@ void CInode::finish_scatter_gather_update(int type)
          dout(20) << "             fragstat " << pf->fragstat << dendl;
          dout(20) << "   accounted_fragstat " << pf->fragstat << dendl;
          pi->dirstat.take_diff(pf->fragstat, 
-                               pf->accounted_fragstat);
+                               pf->accounted_fragstat, touched_mtime);
        } else {
          dout(20) << "  frag " << p->first << " on " << *p->second << dendl;
          dout(20) << "    ignoring OLD accounted_fragstat " << pf->fragstat << dendl;
        }
       }
-      pi->mtime = pi->ctime = pi->dirstat.mtime;
+      if (touched_mtime)
+       pi->mtime = pi->ctime = pi->dirstat.mtime;
       pi->dirstat.version++;
       dout(20) << "        final dirstat " << pi->dirstat << dendl;
       assert(pi->dirstat.size() >= 0);
index ecd16cb516c2a3efe5f301428ea349285d55df62..bd354a33f55cc2c43639ad795d8c0651ecd152f7 100644 (file)
@@ -1411,8 +1411,10 @@ void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob,
     pi->dirstat.version++;
     dout(15) << "predirty_nested take_diff " << pf->fragstat << dendl;
     dout(15) << "predirty_nested         - " << pf->accounted_fragstat << dendl;
-    pi->dirstat.take_diff(pf->fragstat, pf->accounted_fragstat);
-    pi->mtime = pi->ctime = pi->dirstat.mtime;
+    bool touched_mtime = false;
+    pi->dirstat.take_diff(pf->fragstat, pf->accounted_fragstat, touched_mtime);
+    if (touched_mtime)
+      pi->mtime = pi->ctime = pi->dirstat.mtime;
     dout(15) << "predirty_nested     gives " << pi->dirstat << " on " << *pin << dendl;
 
     // next parent!
index 677aa8ff34f5acb1e176f722c33dc75f660e78ea..788393e48525fee4ae8d05b72cf4eaeaf80a8955 100644 (file)
@@ -74,9 +74,11 @@ struct frag_info_t {
   void zero() {
     memset(this, 0, sizeof(*this));
   }
-  void take_diff(const frag_info_t &cur, frag_info_t &acc) {
-    if (cur.mtime > mtime)
+  void take_diff(const frag_info_t &cur, frag_info_t &acc, bool& touched_mtime) {
+    if (cur.mtime > mtime) {
       rctime = mtime = cur.mtime;
+      touched_mtime = true;
+    }
     nfiles += cur.nfiles - acc.nfiles;
     nsubdirs += cur.nsubdirs - acc.nsubdirs;