From 4d1eade0729f5935aba5f53064aa6566c3573772 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Mon, 29 Aug 2016 07:16:40 -0400 Subject: [PATCH] mds: make frag_info_t add_dirty() function take a pointer to touched_mtime ...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 --- src/mds/CDir.cc | 9 ++++----- src/mds/CInode.cc | 2 +- src/mds/MDCache.cc | 2 +- src/mds/mdstypes.h | 5 +++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index b5ef08b6471..e0aaebbab66 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -941,10 +941,9 @@ void CDir::split(int bits, list& subs, list& 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& subs, list& 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); diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index d24aab64ced..22a7be3c70e 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -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; } diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index c95dacb8d5a..574e505a4ef 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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; diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index c7dd37b6b8f..5c900300489 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -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; -- 2.39.5