From: Yan, Zheng Date: Tue, 10 Nov 2015 12:29:29 +0000 (+0800) Subject: mds: remove dir dentry from scrubstack after finishing scrube dirfrags X-Git-Tag: v10.0.1~51^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b65345e319c91c91a9cba41b292458e283ffce56;p=ceph.git mds: remove dir dentry from scrubstack after finishing scrube dirfrags Signed-off-by: Yan, Zheng --- diff --git a/src/mds/CDentry.h b/src/mds/CDentry.h index 6a57d2a14e19..81f0e38ddf16 100644 --- a/src/mds/CDentry.h +++ b/src/mds/CDentry.h @@ -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: /** diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 379d0546adaf..70a4c7f39e8b 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -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; } diff --git a/src/mds/ScrubStack.cc b/src/mds/ScrubStack.cc index 2615dfc47374..948154f33034 100644 --- a/src/mds/ScrubStack.cc +++ b/src/mds/ScrubStack.cc @@ -177,7 +177,6 @@ void ScrubStack::scrub_dir_dentry(CDentry *dn, list::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; diff --git a/src/mds/ScrubStack.h b/src/mds/ScrubStack.h index 69210922e506..fa99859fd278 100644 --- a/src/mds/ScrubStack.h +++ b/src/mds/ScrubStack.h @@ -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.