]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: use MDSInternalContextBase instead of Context in scrub stack code
authorYan, Zheng <zyan@redhat.com>
Thu, 28 Jan 2016 12:24:07 +0000 (20:24 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 7 Mar 2016 07:59:13 +0000 (15:59 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/CInode.cc
src/mds/CInode.h
src/mds/MDCache.cc
src/mds/ScrubStack.cc
src/mds/ScrubStack.h

index cf7b0031ee3f2a85329fe0efc0dcd03dc6183165..966fa7ded64e1f98488c0e22fc66c136c19d0e1f 100644 (file)
@@ -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<frag_t, scrub_stamp_info_t>::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
index 5c7e3ea1445ddf3f879a03094569bf06d526dcb8..5ff343a013f685377bf5ddb399b45fbce9e86a09 100644 (file)
@@ -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;
   }
index ad0f6ac2c7f042cc26b1e098fecf0e39f8c300ca..3bcd4be24015b017305d519cb33a576d8172e2ef 100644 (file)
@@ -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);
 
index 9dcb1a57a252cdf4ae667407db799ddf0540bbb7..1eaddf65fb9d7b6537b5a23772277a67825ad20f 100644 (file)
@@ -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) {
index 39dbddcffb2693f0594060c2358b1d024efaedf5..d12b847367c6a550573e766aa1a357c85679a891 100644 (file)
@@ -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.