]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: make frag_info_t add_dirty() function take a pointer to touched_mtime
authorJeff Layton <jlayton@redhat.com>
Mon, 29 Aug 2016 11:16:40 +0000 (07:16 -0400)
committerJeff Layton <jlayton@redhat.com>
Mon, 29 Aug 2016 14:33:46 +0000 (10:33 -0400)
...rather than messing around with references. While we're at it, we
can also make the argument optional, which allows us to drop an unused
stack variable from CDir::split.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/mds/CDir.cc
src/mds/CInode.cc
src/mds/MDCache.cc
src/mds/mdstypes.h

index b5ef08b64718ac9664de3e381aac03dbad19b2d2..e0aaebbab660c2be1d1bb8ed3b882c2f722712d7 100644 (file)
@@ -941,10 +941,9 @@ void CDir::split(int bits, list<CDir*>& subs, list<MDSInternalContextBase*>& wai
   frag_info_t fragstatdiff;
   if (fnode.accounted_rstat.version == rstat_version)
     rstatdiff.add_delta(fnode.accounted_rstat, fnode.rstat);
-  if (fnode.accounted_fragstat.version == dirstat_version) {
-    bool touched_mtime;
-    fragstatdiff.add_delta(fnode.accounted_fragstat, fnode.fragstat, touched_mtime);
-  }
+  if (fnode.accounted_fragstat.version == dirstat_version)
+    fragstatdiff.add_delta(fnode.accounted_fragstat, fnode.fragstat);
+
   dout(10) << " rstatdiff " << rstatdiff << " fragstatdiff " << fragstatdiff << dendl;
 
   prepare_old_fragment(replay);
@@ -1035,7 +1034,7 @@ void CDir::merge(list<CDir*>& subs, list<MDSInternalContextBase*>& waiters, bool
       rstatdiff.add_delta(dir->fnode.accounted_rstat, dir->fnode.rstat);
     if (dir->fnode.accounted_fragstat.version == dirstat_version)
       fragstatdiff.add_delta(dir->fnode.accounted_fragstat, dir->fnode.fragstat,
-                            touched_mtime);
+                            &touched_mtime);
 
     dir->prepare_old_fragment(replay);
 
index d24aab64ced608245d69e1d7ab03a5c45c26e921..22a7be3c70e702b50403d8569d5a1347ab2ec449 100644 (file)
@@ -2013,7 +2013,7 @@ void CInode::finish_scatter_gather_update(int type)
        if (pf->accounted_fragstat.version == pi->dirstat.version - 1) {
          dout(20) << fg << "           fragstat " << pf->fragstat << dendl;
          dout(20) << fg << " accounted_fragstat " << pf->accounted_fragstat << dendl;
-         pi->dirstat.add_delta(pf->fragstat, pf->accounted_fragstat, touched_mtime);
+         pi->dirstat.add_delta(pf->fragstat, pf->accounted_fragstat, &touched_mtime);
        } else {
          dout(20) << fg << " skipping STALE accounted_fragstat " << pf->accounted_fragstat << dendl;
        }
index c95dacb8d5a0cd867fe1b03185ed3cc045d5dd80..574e505a4ef567ba8f0dc714dcb339732727ffe8 100644 (file)
@@ -2278,7 +2278,7 @@ void MDCache::predirty_journal_parents(MutationRef mut, EMetaBlob *blob,
       dout(20) << "predirty_journal_parents add_delta " << pf->fragstat << dendl;
       dout(20) << "predirty_journal_parents         - " << pf->accounted_fragstat << dendl;
       bool touched_mtime = false;
-      pi->dirstat.add_delta(pf->fragstat, pf->accounted_fragstat, touched_mtime);
+      pi->dirstat.add_delta(pf->fragstat, pf->accounted_fragstat, &touched_mtime);
       pf->accounted_fragstat = pf->fragstat;
       if (touched_mtime)
        pi->mtime = pi->ctime = pi->dirstat.mtime;
index c7dd37b6b8fff8f32adecd3ab73cf2677710bc38..5c900300489bcbebd87ac1ff006123568cb11229 100644 (file)
@@ -181,10 +181,11 @@ struct frag_info_t : public scatter_info_t {
   }
 
   // *this += cur - acc;
-  void add_delta(const frag_info_t &cur, frag_info_t &acc, bool& touched_mtime) {
+  void add_delta(const frag_info_t &cur, frag_info_t &acc, bool *touched_mtime=0) {
     if (cur.mtime > mtime) {
       mtime = cur.mtime;
-      touched_mtime = true;
+      if (touched_mtime)
+       *touched_mtime = true;
     }
     nfiles += cur.nfiles - acc.nfiles;
     nsubdirs += cur.nsubdirs - acc.nsubdirs;