]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: don't need separate variable to mark hits when lookup oid. 44216/head
authorlocallocal <locallocal@163.com>
Mon, 6 Dec 2021 02:01:50 +0000 (10:01 +0800)
committerlocallocal <locallocal@163.com>
Mon, 6 Dec 2021 02:26:53 +0000 (10:26 +0800)
Signed-off-by: locallocal <locallocal@163.com>
src/os/bluestore/BlueStore.cc

index c8242cb072f263c20ad527d1a3ac25c36219d949..b0a4b88c787743a275660565ad001d4e9fb25c57 100644 (file)
@@ -1916,12 +1916,12 @@ BlueStore::OnodeRef BlueStore::OnodeSpace::lookup(const ghobject_t& oid)
 {
   ldout(cache->cct, 30) << __func__ << dendl;
   OnodeRef o;
-  bool hit = false;
 
   {
     std::lock_guard l(cache->lock);
     ceph::unordered_map<ghobject_t,OnodeRef>::iterator p = onode_map.find(oid);
     if (p == onode_map.end()) {
+      cache->logger->inc(l_bluestore_onode_misses);
       ldout(cache->cct, 30) << __func__ << " " << oid << " miss" << dendl;
     } else {
       ldout(cache->cct, 30) << __func__ << " " << oid << " hit " << p->second
@@ -1934,15 +1934,10 @@ BlueStore::OnodeRef BlueStore::OnodeSpace::lookup(const ghobject_t& oid)
       o = p->second;
       ceph_assert(!o->cached || o->pinned);
 
-      hit = true;
+      cache->logger->inc(l_bluestore_onode_hits);
     }
   }
 
-  if (hit) {
-    cache->logger->inc(l_bluestore_onode_hits);
-  } else {
-    cache->logger->inc(l_bluestore_onode_misses);
-  }
   return o;
 }