Skip to content

Commit

Permalink
mds: ignore CDir::check_rstats() when debug_scatterstat is off
Browse files Browse the repository at this point in the history
It uses lots of CPU when dirfrag is large

Signed-off-by: Yan, Zheng <[email protected]>
  • Loading branch information
Yan, Zheng committed Apr 2, 2014
1 parent 5a9b99a commit 43bc39b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/mds/CDir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 43bc39b

Please sign in to comment.