From: Yan, Zheng Date: Thu, 28 Jan 2016 12:24:07 +0000 (+0800) Subject: mds: use MDSInternalContextBase instead of Context in scrub stack code X-Git-Tag: v10.1.0~176^2~1^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d98c516af7bf18a9d128c4d10c81eaa6b6203e89;p=ceph.git mds: use MDSInternalContextBase instead of Context in scrub stack code Signed-off-by: Yan, Zheng --- diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index cf7b0031ee3f..966fa7ded64e 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -4146,7 +4146,8 @@ void CInode::scrub_maybe_delete_info() } void CInode::scrub_initialize(CDentry *scrub_parent, - const ScrubHeaderRefConst& header, Context *f) + const ScrubHeaderRefConst& header, + MDSInternalContextBase *f) { dout(20) << __func__ << " with scrub_version " << get_version() << dendl; assert(!scrub_infop || !scrub_infop->scrub_in_progress); @@ -4245,7 +4246,7 @@ void CInode::scrub_dirfrag_finished(frag_t dirfrag) si.last_scrub_version = si.scrub_start_version; } -void CInode::scrub_finished(Context **c) { +void CInode::scrub_finished(MDSInternalContextBase **c) { dout(20) << __func__ << dendl; assert(scrub_info()->scrub_in_progress); for (std::map::iterator i = @@ -4272,6 +4273,7 @@ void CInode::scrub_finished(Context **c) { } *c = scrub_infop->on_finish; + scrub_infop->on_finish = NULL; if (scrub_infop->header && scrub_infop->header->origin == this) { // We are at the point that a tagging scrub was initiated diff --git a/src/mds/CInode.h b/src/mds/CInode.h index 5c7e3ea1445d..5ff343a013f6 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -266,7 +266,7 @@ public: class scrub_info_t : public scrub_stamp_info_t { public: CDentry *scrub_parent; - Context *on_finish; + MDSInternalContextBase *on_finish; bool last_scrub_dirty; /// are our stamps dirty with respect to disk state? bool scrub_in_progress; /// are we currently scrubbing? @@ -297,7 +297,8 @@ public: * directory's get_projected_version()) */ void scrub_initialize(CDentry *scrub_parent, - const ScrubHeaderRefConst& header, Context *f); + const ScrubHeaderRefConst& header, + MDSInternalContextBase *f); /** * Get the next dirfrag to scrub. Gives you a frag_t in output param which * you must convert to a CDir (and possibly load off disk). @@ -328,14 +329,14 @@ public: * @param c An out param which is filled in with a Context* that must * be complete()ed. */ - void scrub_finished(Context **c); + void scrub_finished(MDSInternalContextBase **c); /** * Report to the CInode that alldirfrags it owns have been scrubbed. */ void scrub_children_finished() { scrub_infop->children_scrubbed = true; } - void scrub_set_finisher(Context *c) { + void scrub_set_finisher(MDSInternalContextBase *c) { assert(!scrub_infop->on_finish); scrub_infop->on_finish = c; } diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index ad0f6ac2c7f0..3bcd4be24015 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -11756,7 +11756,8 @@ void MDCache::enqueue_scrub_work(MDRequestRef& mdr) // want to block asok caller on long running scrub if (!header->recursive) { Context *fin = cs->take_finisher(); - mds->scrubstack->enqueue_inode_top(in, header, fin); + mds->scrubstack->enqueue_inode_top(in, header, + new MDSInternalContextWrapper(mds, fin)); } else mds->scrubstack->enqueue_inode_bottom(in, header, NULL); diff --git a/src/mds/ScrubStack.cc b/src/mds/ScrubStack.cc index 9dcb1a57a252..1eaddf65fb9d 100644 --- a/src/mds/ScrubStack.cc +++ b/src/mds/ScrubStack.cc @@ -59,7 +59,7 @@ void ScrubStack::pop_inode(CInode *in) void ScrubStack::_enqueue_inode(CInode *in, CDentry *parent, const ScrubHeaderRefConst& header, - Context *on_finish, bool top) + MDSInternalContextBase *on_finish, bool top) { dout(10) << __func__ << " with {" << *in << "}" << ", on_finish=" << on_finish << ", top=" << top << dendl; @@ -72,7 +72,7 @@ void ScrubStack::_enqueue_inode(CInode *in, CDentry *parent, } void ScrubStack::enqueue_inode(CInode *in, const ScrubHeaderRefConst& header, - Context *on_finish, bool top) + MDSInternalContextBase *on_finish, bool top) { _enqueue_inode(in, NULL, header, on_finish, top); kick_off_scrubs(); @@ -383,7 +383,7 @@ void ScrubStack::_validate_inode_done(CInode *in, int r, #endif const ScrubHeaderRefConst header = in->scrub_info()->header; - Context *c = NULL; + MDSInternalContextBase *c = NULL; in->scrub_finished(&c); if (!header->recursive && in == header->origin) { diff --git a/src/mds/ScrubStack.h b/src/mds/ScrubStack.h index 39dbddcffb26..d12b847367c6 100644 --- a/src/mds/ScrubStack.h +++ b/src/mds/ScrubStack.h @@ -74,14 +74,14 @@ public: * was initiated */ void enqueue_inode_top(CInode *in, const ScrubHeaderRefConst& header, - Context *on_finish) { + MDSInternalContextBase *on_finish) { enqueue_inode(in, header, on_finish, true); } /** Like enqueue_inode_top, but we wait for all pending scrubs before * starting this one. */ void enqueue_inode_bottom(CInode *in, const ScrubHeaderRefConst& header, - Context *on_finish) { + MDSInternalContextBase *on_finish) { enqueue_inode(in, header, on_finish, false); } @@ -91,9 +91,9 @@ private: * the given scrub params, and then try and kick off more scrubbing. */ void enqueue_inode(CInode *in, const ScrubHeaderRefConst& header, - Context *on_finish, bool top); + MDSInternalContextBase *on_finish, bool top); void _enqueue_inode(CInode *in, CDentry *parent, const ScrubHeaderRefConst& header, - Context *on_finish, bool top); + MDSInternalContextBase *on_finish, bool top); /** * Kick off as many scrubs as are appropriate, based on the current * state of the stack.