]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: use find instead of count in CInode::get_dirfrag 19224/head
authorroot <tdd108128@163.com>
Wed, 29 Nov 2017 05:27:30 +0000 (13:27 +0800)
committerroot <tdd108128@163.com>
Wed, 29 Nov 2017 05:44:51 +0000 (13:44 +0800)
Signed-off-by: dongdong tao <tdd21151186@gmail.com>
src/mds/CInode.h

index 01c942c9cf533e6fa48f59d8cc94af966026948d..94da0671bab9a3eadc4337a80e15d2ca99119cfa 100644 (file)
@@ -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<CDir*>& ls);
   CDir* get_approx_dirfrag(frag_t fg);