From 1d4abf7e39fbfce674095161bfd002d0b5abece5 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Fri, 13 Jan 2023 15:04:48 +0300 Subject: [PATCH] os/bluestore: touch onode in cache LRU explicitly. Signed-off-by: Igor Fedotov --- src/os/bluestore/BlueStore.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 390f286774a..a39c94aa52a 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1155,13 +1155,22 @@ struct LruOnodeCacheShard : public BlueStore::OnodeCacheShard { ceph_assert(num); --num; o->clear_cached(); + dout(20) << __func__ << " " << this << " " << o->oid << " removed" + << dendl; // remove will also decrement nref o->c->onode_space._remove(o->oid); } } else if (o->exists) { // move onode within LRU - _rm(o); - _add(o, 1); + lru.erase(lru.iterator_to(*o)); + lru.push_front(*o); + if (o->cache_age_bin != age_bins.front()) { + *(o->cache_age_bin) -= 1; + o->cache_age_bin = age_bins.front(); + *(o->cache_age_bin) += 1; + } + dout(20) << __func__ << " " << this << " " << o->oid << " touched" + << dendl; } } ocs->lock.unlock(); -- 2.39.5