--num_pinned;
dout(20) << __func__ << this << " " << " " << " " << o->oid << " unpinned" << dendl;
}
-
+ void _unpin_and_rm(BlueStore::Onode* o) override
+ {
+ o->pop_cache();
+ ceph_assert(num_pinned);
+ --num_pinned;
+ ceph_assert(num);
+ --num;
+ }
void _trim_to(uint64_t new_size) override
{
if (new_size >= lru.size()) {
n = --nref;
}
if (cached && r) {
- ocs->_unpin(this);
+ if (exists) {
+ ocs->_unpin(this);
+ } else {
+ ocs->_unpin_and_rm(this);
+ // remove will also decrement nref and delete Onode
+ c->onode_map._remove(oid);
+ }
}
}
if (n == 0) {
PerfCounters *logger);
virtual void _add(Onode* o, int level) = 0;
virtual void _rm(Onode* o) = 0;
+ virtual void _unpin_and_rm(Onode* o) = 0;
virtual void move_pinned(OnodeCacheShard *to, Onode *o) = 0;
virtual void add_stats(uint64_t *onodes, uint64_t *pinned_onodes) = 0;
/// forward lookups
mempool::bluestore_cache_meta::unordered_map<ghobject_t,OnodeRef> onode_map;
- friend class Collection; // for split_cache()
-
+ friend struct Collection; // for split_cache()
+ friend struct Onode; // for put()
friend struct LruOnodeCacheShard;
void _remove(const ghobject_t& oid);
public: