From 43bc39beabf3e9794696c328f886aa594a19fe23 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Tue, 1 Apr 2014 22:42:14 +0800 Subject: [PATCH] mds: ignore CDir::check_rstats() when debug_scatterstat is off It uses lots of CPU when dirfrag is large Signed-off-by: Yan, Zheng --- src/mds/CDir.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 10189773caf2a..35573b656896b 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -212,6 +212,9 @@ CDir::CDir(CInode *in, frag_t fg, MDCache *mdcache, bool auth) : */ bool CDir::check_rstats() { + if (!g_conf->mds_debug_scatterstat) + return true; + dout(25) << "check_rstats on " << this << dendl; if (!is_complete() || !is_auth() || is_frozen()) { dout(10) << "check_rstats bailing out -- incomplete or non-auth or frozen dir!" << dendl; @@ -229,9 +232,7 @@ bool CDir::check_rstats() //if (i->second->get_linkage()->is_primary()) dout(1) << *(i->second) << dendl; } - assert(!g_conf->mds_debug_scatterstat || - (get_num_head_items() == - (fnode.fragstat.nfiles + fnode.fragstat.nsubdirs))); + assert(get_num_head_items() == (fnode.fragstat.nfiles + fnode.fragstat.nsubdirs)); } else { dout(20) << "get_num_head_items() = " << get_num_head_items() << "; fnode.fragstat.nfiles=" << fnode.fragstat.nfiles @@ -265,9 +266,9 @@ bool CDir::check_rstats() dout(25) << "my rstats: " << fnode.rstat << dendl; } - assert(!g_conf->mds_debug_scatterstat || sub_info.rbytes == fnode.rstat.rbytes); - assert(!g_conf->mds_debug_scatterstat || sub_info.rfiles == fnode.rstat.rfiles); - assert(!g_conf->mds_debug_scatterstat || sub_info.rsubdirs == fnode.rstat.rsubdirs); + assert(sub_info.rbytes == fnode.rstat.rbytes); + assert(sub_info.rfiles == fnode.rstat.rfiles); + assert(sub_info.rsubdirs == fnode.rstat.rsubdirs); dout(10) << "check_rstats complete on " << this << dendl; return true; } -- 2.39.5