From f57b15fb10598cd546d6a1b4a4273415fad9b649 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 10 Jun 2008 07:10:46 -0700 Subject: [PATCH] mds: make scatter gather completion skip fragstat/accounted_fragstat differential when version is old (i.e. it was already counted) --- src/TODO | 2 -- src/mds/CInode.cc | 31 ++++++++++++++++--------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/TODO b/src/TODO index c4d27036f7b45..7f9dd68512880 100644 --- a/src/TODO +++ b/src/TODO @@ -63,8 +63,6 @@ mds - fix replay (dont want dir frozen, pins, etc.?) - fix accounting -- make sure fragstat rejoin works - it should compare fragstat.version? - - proper handling of cache expire messages during rejoin phase? -> i think cache expires are fine; the rejoin_ack handler just has to behave if rejoining items go missing - try_remove_unlinked_dn thing diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index e9481327a9d4b..c61205d5c4f70 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -653,16 +653,12 @@ void CInode::decode_lock_state(int type, bufferlist& bl) CDir *dir = get_dirfrag(fg); if (is_auth()) { assert(dir); // i am auth; i had better have this dir open - if (!(fragstat == accounted_fragstat)) { - dout(10) << " got changed fragstat " << fragstat << " on " << *dir << dendl; - dout(20) << " accounted_fragstat " << accounted_fragstat << dendl; - dir->fnode.fragstat = fragstat; - dir->fnode.accounted_fragstat = accounted_fragstat; + dout(10) << " " << fg << " fragstat " << fragstat << " on " << *dir << dendl; + dout(20) << " " << fg << " accounted_fragstat " << accounted_fragstat << dendl; + dir->fnode.fragstat = fragstat; + dir->fnode.accounted_fragstat = accounted_fragstat; + if (!(fragstat == accounted_fragstat)) dirlock.set_updated(); - } else { - dout(10) << " fully accounted fragstat " << fragstat << " on " << *dir << dendl; - assert(dir->fnode.fragstat == fragstat); - } } else { if (dir && dir->is_auth() && @@ -712,17 +708,22 @@ void CInode::finish_scatter_gather_update(int type) assert(is_auth()); inode_t *pi = get_projected_inode(); dout(20) << " orig dirstat " << pi->dirstat << dendl; - pi->dirstat.version++; for (map::iterator p = dirfrags.begin(); p != dirfrags.end(); p++) { fnode_t *pf = p->second->get_projected_fnode(); - dout(20) << " frag " << p->first << " " << *p->second << dendl; - dout(20) << " fragstat " << pf->fragstat << dendl; - dout(20) << " accounted_fragstat " << pf->fragstat << dendl; - pi->dirstat.take_diff(pf->fragstat, - pf->accounted_fragstat); + if (pf->accounted_fragstat.version == pi->dirstat.version) { + dout(20) << " frag " << p->first << " " << *p->second << dendl; + dout(20) << " fragstat " << pf->fragstat << dendl; + dout(20) << " accounted_fragstat " << pf->fragstat << dendl; + pi->dirstat.take_diff(pf->fragstat, + pf->accounted_fragstat); + } else { + dout(20) << " frag " << p->first << " on " << *p->second << dendl; + dout(20) << " ignoring OLD accounted_fragstat " << pf->fragstat << dendl; + } } + pi->dirstat.version++; dout(20) << " final dirstat " << pi->dirstat << dendl; } break; -- 2.39.5