]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: get rid off OnodeShardCache::_touch.
authorIgor Fedotov <ifedotov@suse.com>
Fri, 24 Jan 2020 23:00:29 +0000 (02:00 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Mon, 6 Jul 2020 13:07:14 +0000 (16:07 +0300)
Onode pinning does the same for us.

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 66a60d6620c15233ab94ee7b8ecea9a888f98729..b36a045720509316fac3d36561dc07d29dfc9240 100644 (file)
@@ -813,14 +813,6 @@ struct LruOnodeCacheShard : public BlueStore::OnodeCacheShard {
     }
     --num;
   }
-  void _touch(BlueStore::Onode* o) override
-  {
-    ceph_assert(o->cached);
-    if (!o->pinned) {
-      lru.erase(lru.iterator_to(*o));
-      lru.push_front(*o);
-    }
-  }
   void _pin(BlueStore::Onode* o) override
   {
     lru.erase(lru.iterator_to(*o));
@@ -1589,10 +1581,11 @@ BlueStore::OnodeRef BlueStore::OnodeSpace::lookup(const ghobject_t& oid)
     } else {
       ldout(cache->cct, 30) << __func__ << " " << oid << " hit " << p->second
                            << dendl;
-      // assign before _touch to pin object if needed and avoid
-      // cache touch
+      // This will pin onode and implicitly touch the cache when Onode
+      // eventually will become unpinned
       o = p->second;
-      cache->_touch(p->second.get());
+      ceph_assert(!o->cached || o->pinned);
+
       hit = true;
     }
   }
@@ -1648,9 +1641,12 @@ void BlueStore::OnodeSpace::rename(
   oldo.reset(new Onode(o->c, old_oid, o->key));
   po->second = oldo;
   cache->_add(oldo.get(), 1);
-  // add at new position and fix oid, key
+  // add at new position and fix oid, key.
+  // This will pin 'o' and implicitly touch cache
+  // when it will eventually become unpinned
   onode_map.insert(make_pair(new_oid, o));
-  cache->_touch(o.get());
+  ceph_assert(o->pinned);
+
   o->oid = new_oid;
   o->key = new_okey;
   cache->_trim();
index 24d83aafbd3fc4401b8480ca8515cb9df846f505..f07d0fad770b6bcdee0128884a0ce140cc08e705 100644 (file)
@@ -1216,7 +1216,6 @@ public:
                                    PerfCounters *logger);
     virtual void _add(Onode* o, int level) = 0;
     virtual void _rm(Onode* o) = 0;
-    virtual void _touch(Onode* o) = 0;
 
     void pin(Onode* o, std::function<bool ()> validator) {
       std::lock_guard l(lock);