From: Igor Fedotov Date: Fri, 24 Jan 2020 23:00:29 +0000 (+0300) Subject: os/bluestore: get rid off OnodeShardCache::_touch. X-Git-Tag: v16.1.0~1756^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=45b1db15f677b36d971909b406fc2f210a3dca7d;p=ceph.git os/bluestore: get rid off OnodeShardCache::_touch. Onode pinning does the same for us. Signed-off-by: Igor Fedotov --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 66a60d6620c1..b36a04572050 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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(); diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 24d83aafbd3f..f07d0fad770b 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -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 validator) { std::lock_guard l(lock);