From 82aa79f8637914e3014a6c9c89516ed6778152eb Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 10 Nov 2010 09:43:56 -0800 Subject: [PATCH] mds: fix inode->frag rstat projected with snaps The snapid 'first' value needs to be >= inode->first; move that into the helper. Signed-off-by: Sage Weil --- src/mds/MDCache.cc | 15 +++++++++------ src/mds/MDCache.h | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index e464562ef0ad3..5265a1d047d76 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -1433,6 +1433,11 @@ void MDCache::project_rstat_inode_to_frag(CInode *cur, CDir *parent, snapid_t fi CDentry *parentdn = cur->get_projected_parent_dn(); inode_t *curi = cur->get_projected_inode(); + if (cur->first > first) + first = cur->first; + + dout(10) << "projected_rstat_inode_to_frag first " << first << " linkunlink " << linkunlink + << " " << *cur << dendl; dout(20) << " frag head is [" << parent->first << ",head] " << dendl; dout(20) << " inode update is [" << first << "," << cur->last << "]" << dendl; @@ -1445,23 +1450,23 @@ void MDCache::project_rstat_inode_to_frag(CInode *cur, CDir *parent, snapid_t fi dout(20) << " floor of " << floor << " from parent dn " << *parentdn << dendl; if (cur->last >= floor) - project_rstat_inode_to_frag(*curi, MAX(first, floor), cur->last, parent, linkunlink); + _project_rstat_inode_to_frag(*curi, MAX(first, floor), cur->last, parent, linkunlink); for (set::iterator p = cur->dirty_old_rstats.begin(); p != cur->dirty_old_rstats.end(); p++) { old_inode_t& old = cur->old_inodes[*p]; if (*p >= floor) - project_rstat_inode_to_frag(old.inode, MAX(old.first, floor), *p, parent); + _project_rstat_inode_to_frag(old.inode, MAX(old.first, floor), *p, parent); } cur->dirty_old_rstats.clear(); } -void MDCache::project_rstat_inode_to_frag(inode_t& inode, snapid_t ofirst, snapid_t last, +void MDCache::_project_rstat_inode_to_frag(inode_t& inode, snapid_t ofirst, snapid_t last, CDir *parent, int linkunlink) { - dout(10) << "project_rstat_inode_to_frag [" << ofirst << "," << last << "]" << dendl; + dout(10) << "_project_rstat_inode_to_frag [" << ofirst << "," << last << "]" << dendl; dout(20) << " inode rstat " << inode.rstat << dendl; dout(20) << " inode accounted_rstat " << inode.accounted_rstat << dendl; nest_info_t delta; @@ -1782,8 +1787,6 @@ void MDCache::predirty_journal_parents(Mutation *mut, EMetaBlob *blob, follows = prealm->get_newest_seq(); snapid_t first = follows+1; - if (cur->first > first) - first = cur->first; // first, if the frag is stale, bring it back in sync. parent->resync_accounted_rstat(); diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index f44e19b3da1f0..38b6d1a8fb231 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -577,8 +577,8 @@ public: inode_t *journal_dirty_inode(Mutation *mut, EMetaBlob *metablob, CInode *in, snapid_t follows=CEPH_NOSNAP); void project_rstat_inode_to_frag(CInode *cur, CDir *parent, snapid_t first, int linkunlink); - void project_rstat_inode_to_frag(inode_t& inode, snapid_t ofirst, snapid_t last, - CDir *parent, int linkunlink=0); + void _project_rstat_inode_to_frag(inode_t& inode, snapid_t ofirst, snapid_t last, + CDir *parent, int linkunlink=0); void project_rstat_frag_to_inode(nest_info_t& rstat, nest_info_t& accounted_rstat, snapid_t ofirst, snapid_t last, CInode *pin, bool cow_head); -- 2.39.5