From: root Date: Wed, 29 Nov 2017 05:27:30 +0000 (+0800) Subject: mds: use find instead of count in CInode::get_dirfrag X-Git-Tag: v13.0.2~863^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5df6237bd141b5c8de0e47d08307e2b7391a7271;p=ceph.git mds: use find instead of count in CInode::get_dirfrag Signed-off-by: dongdong tao --- diff --git a/src/mds/CInode.h b/src/mds/CInode.h index 01c942c9cf5..94da0671bab 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -526,11 +526,12 @@ private: public: bool has_dirfrags() { return !dirfrags.empty(); } CDir* get_dirfrag(frag_t fg) { - if (dirfrags.count(fg)) { + auto pi = dirfrags.find(fg); + if (pi != dirfrags.end()) { //assert(g_conf->debug_mds < 2 || dirfragtree.is_leaf(fg)); // performance hack FIXME - return dirfrags[fg]; - } else - return NULL; + return pi->second; + } + return NULL; } bool get_dirfrags_under(frag_t fg, std::list& ls); CDir* get_approx_dirfrag(frag_t fg);