]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: remove dir dentry from scrubstack after finishing scrube dirfrags
authorYan, Zheng <zyan@redhat.com>
Tue, 10 Nov 2015 12:29:29 +0000 (20:29 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 10 Nov 2015 14:21:34 +0000 (22:21 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/CDentry.h
src/mds/CDir.cc
src/mds/ScrubStack.cc
src/mds/ScrubStack.h

index 6a57d2a14e198764573f7bb257c0d20b23e3682a..81f0e38ddf161f26c2c7c07505a57cbc53bdf0ae 100644 (file)
@@ -147,14 +147,16 @@ public:
     bool scrub_recursive; /// true if we are scrubbing everything under this
     bool scrub_children; /// true if we have to scrub all direct children
     bool dentry_scrubbing; /// safety check
+    bool dentry_children_done; /// safety check
+    bool inode_validated;  /// Has our inode's validate_disk_state run?
     Context *on_finish; /// called when we finish scrubbing
     ScrubHeaderRefConst header;
-    bool inode_validated;  /// Has our inode's validate_disk_state run?
 
     scrub_info_t() :
       scrub_parent(NULL), scrub_recursive(false),
-      scrub_children(false), dentry_scrubbing(false), on_finish(NULL),
-      inode_validated(false)
+      scrub_children(false), dentry_scrubbing(false),
+      dentry_children_done(false), inode_validated(false),
+      on_finish(NULL)
     {}
   };
 
@@ -181,6 +183,9 @@ public:
                         ScrubHeaderRefConst header,
                         Context *f);
   void scrub_finished(Context **c);
+  void scrub_children_finished() {
+    scrub_infop->dentry_children_done = true;
+  }
 
 private:
   /**
index 379d0546adafa5d4f3dd2fcd40f919b8453db4f6..70a4c7f39e8bd7893510963e0185a8c3fa950e4f 100644 (file)
@@ -2937,8 +2937,6 @@ void CDir::scrub_finished()
   scrub_infop->others_scrubbed.clear();
   scrub_infop->directory_scrubbing = false;
 
-  scrub_infop->last_scrub_dirty = true;
-
   scrub_infop->last_recursive = scrub_infop->recursive_start;
   scrub_infop->last_scrub_dirty = true;
 }
index 2615dfc47374dcd45ff8280221e848699b238a10..948154f3303429cd97c9ca6eb9fd692cb019ebb3 100644 (file)
@@ -177,7 +177,6 @@ void ScrubStack::scrub_dir_dentry(CDentry *dn,
   list<CDir*>::iterator i = scrubbing_cdirs.begin();
   bool all_frags_terminal = true;
   bool all_frags_done = true;
-  bool finally_done = false;
   while (g_conf->mds_max_scrub_ops_in_progress > scrubs_in_progress) {
     // select next CDir
     CDir *cur_dir = NULL;
@@ -227,12 +226,11 @@ void ScrubStack::scrub_dir_dentry(CDentry *dn,
     // OK, so now I can... fire off a validate on the dir inode, and
     // when it completes, come through here again, noticing that we've
     // set a flag to indicate the the validate happened, and 
-
-    scrub_dir_dentry_final(dn, &finally_done);
+    scrub_dir_dentry_final(dn);
   }
 
   *terminal = all_frags_terminal;
-  *done = all_frags_done && finally_done;
+  *done = all_frags_done;
   dout(10) << __func__ << " is exiting " << *terminal << " " << *done << dendl;
   return;
 }
@@ -282,7 +280,7 @@ class C_InodeValidated : public MDSInternalContext
 };
 
 
-void ScrubStack::scrub_dir_dentry_final(CDentry *dn, bool *finally_done)
+void ScrubStack::scrub_dir_dentry_final(CDentry *dn)
 {
   dout(20) << __func__ << *dn << dendl;
 
@@ -293,8 +291,8 @@ void ScrubStack::scrub_dir_dentry_final(CDentry *dn, bool *finally_done)
   // doing our validate_disk_state on the inode
   // FIXME: the magic-constructing scrub_info() is going to leave
   // an unneeded scrub_infop lying around here
-  *finally_done = !dn->scrub_info()->dentry_scrubbing;
-  if (!*finally_done) {
+  if (!dn->scrub_info()->dentry_children_done) {
+    dn->scrub_children_finished();
     CInode *in = dn->get_projected_inode();
     C_InodeValidated *fin = new C_InodeValidated(mdcache->mds, this, dn);
     MDRequestRef null_mdr;
index 69210922e506e6c0e20cb90eb1a93985c51b4cd6..fa99859fd2783d82432bb556ae2a28305865db56 100644 (file)
@@ -166,10 +166,8 @@ private:
    * Scrub a directory-representing dentry.
    *
    * @param dn The CDentry of the directory we're doing final scrub on.
-   * @param done Set to true if the dentry scrub is finished. (That
-   * won't every actually happen, right? It needs disk accesses? I forget.)
    */
-  void scrub_dir_dentry_final(CDentry *dn, bool *done);
+  void scrub_dir_dentry_final(CDentry *dn);
 
   /**
    * Get a CDir into memory, and return it if it's already complete.