mds: minor cleanup for EFragment and MMDSFragmentNotify

pass dirfrag_t to their constructors, instead of passing inode_t
and frag_t separately.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
This commit is contained in:
Yan, Zheng 2014-01-16 11:24:08 +08:00
parent 9df6861b31
commit 3dc51dea31
3 changed files with 9 additions and 12 deletions

View File

@ -11428,8 +11428,7 @@ void MDCache::dispatch_fragment_dir(MDRequest *mdr)
return;
mdr->ls = mds->mdlog->get_current_segment();
EFragment *le = new EFragment(mds->mdlog, EFragment::OP_PREPARE,
basedirfrag.ino, basedirfrag.frag, info.bits);
EFragment *le = new EFragment(mds->mdlog, EFragment::OP_PREPARE, basedirfrag, info.bits);
mds->mdlog->start_entry(le);
for (list<CDir*>::iterator p = info.dirs.begin(); p != info.dirs.end(); ++p) {
@ -11529,7 +11528,7 @@ void MDCache::_fragment_stored(MDRequest *mdr)
rejoin_gather.count(p->first)))
continue;
MMDSFragmentNotify *notify = new MMDSFragmentNotify(basedirfrag.ino, basedirfrag.frag, info.bits);
MMDSFragmentNotify *notify = new MMDSFragmentNotify(basedirfrag, info.bits);
// freshly replicate new dirs to peers
for (list<CDir*>::iterator q = info.resultfrags.begin();
@ -11564,8 +11563,7 @@ void MDCache::_fragment_stored(MDRequest *mdr)
}
// journal commit
EFragment *le = new EFragment(mds->mdlog, EFragment::OP_COMMIT,
basedirfrag, info.bits);
EFragment *le = new EFragment(mds->mdlog, EFragment::OP_COMMIT, basedirfrag, info.bits);
mds->mdlog->start_submit_entry(le, new C_MDC_FragmentCommit(this, basedirfrag,
info.resultfrags));
@ -11620,8 +11618,7 @@ void MDCache::_fragment_finish(dirfrag_t basedirfrag, list<CDir*>& resultfrags)
(*p)->auth_unpin(this);
}
EFragment *le = new EFragment(mds->mdlog, EFragment::OP_FINISH,
basedirfrag.ino, basedirfrag.frag, uf.bits);
EFragment *le = new EFragment(mds->mdlog, EFragment::OP_FINISH, basedirfrag, uf.bits);
mds->mdlog->start_submit_entry(le);
finish_uncommitted_fragment(basedirfrag, EFragment::OP_FINISH);
@ -11753,7 +11750,7 @@ void MDCache::rollback_uncommitted_fragments()
dout(10) << " rolling back " << p->first << " refragment by " << uf.bits << " bits" << dendl;
LogSegment *ls = mds->mdlog->get_current_segment();
EFragment *le = new EFragment(mds->mdlog, EFragment::OP_ROLLBACK, diri->ino(), p->first.frag, uf.bits);
EFragment *le = new EFragment(mds->mdlog, EFragment::OP_ROLLBACK, p->first, uf.bits);
mds->mdlog->start_entry(le);
list<frag_t> old_frags;

View File

@ -37,9 +37,9 @@ public:
bufferlist rollback;
EFragment() : LogEvent(EVENT_FRAGMENT) { }
EFragment(MDLog *mdlog, int o, inodeno_t i, frag_t bf, int b) :
EFragment(MDLog *mdlog, int o, dirfrag_t df, int b) :
LogEvent(EVENT_FRAGMENT), metablob(mdlog),
op(o), ino(i), basefrag(bf), bits(b) { }
op(o), ino(df.ino), basefrag(df.frag), bits(b) { }
void print(ostream& out) const {
out << "EFragment " << op_name(op) << " " << ino << " " << basefrag << " by " << bits << " " << metablob;

View File

@ -32,9 +32,9 @@ class MMDSFragmentNotify : public Message {
bufferlist basebl;
MMDSFragmentNotify() : Message(MSG_MDS_FRAGMENTNOTIFY) {}
MMDSFragmentNotify(inodeno_t i, frag_t bf, int b) :
MMDSFragmentNotify(dirfrag_t df, int b) :
Message(MSG_MDS_FRAGMENTNOTIFY),
ino(i), basefrag(bf), bits(b) { }
ino(df.ino), basefrag(df.frag), bits(b) { }
private:
~MMDSFragmentNotify() {}