diff options
author | Igor Fedotov <ifedotov@suse.com> | 2021-12-14 15:56:37 +0100 |
---|---|---|
committer | Igor Fedotov <ifedotov@suse.com> | 2021-12-20 13:15:15 +0100 |
commit | 0960f981f72009086317710f51c5acefe1bd7232 (patch) | |
tree | 74d29fe2044dcbde1ffacaddd752160497fba90a /src/os | |
parent | Merge pull request #44216 from locallocal/master (diff) | |
download | ceph-0960f981f72009086317710f51c5acefe1bd7232.tar.xz ceph-0960f981f72009086317710f51c5acefe1bd7232.zip |
os/bluestore: get rid of fake onode nref increment for pinned entry
Looks like this isn't necessary any more after fixing
https://tracker.ceph.com/issues/53002
Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/bluestore/BlueStore.cc | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 4d8b7f3f3e1..78709eb5dc8 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -3623,14 +3623,7 @@ void BlueStore::Onode::calc_omap_tail( _key_encode_u64(o->onode.nid, out); out->push_back('~'); } -// -// A tricky thing about Onode's ref counter is that we do an additional -// increment when newly pinned instance is detected. And -1 on unpin. -// This prevents from a conflict with a delete call (when nref == 0). -// The latter might happen while the thread is in unpin() function -// (and e.g. waiting for lock acquisition) since nref is already -// decremented. And another 'putting' thread on the instance will release it. -// + void BlueStore::Onode::get() { if (++nref >= 2 && !pinned) { OnodeCacheShard* ocs = c->get_onode_cache(); @@ -3643,11 +3636,7 @@ void BlueStore::Onode::get() { } bool was_pinned = pinned; pinned = nref >= 2; - // additional increment for newly pinned instance bool r = !was_pinned && pinned; - if (r) { - ++nref; - } if (cached && r) { ocs->_pin(this); } @@ -3657,7 +3646,7 @@ void BlueStore::Onode::get() { void BlueStore::Onode::put() { ++put_nref; int n = --nref; - if (n == 2) { + if (n == 1) { OnodeCacheShard* ocs = c->get_onode_cache(); ocs->lock.lock(); // It is possible that during waiting split_cache moved us to different OnodeCacheShard. @@ -3667,8 +3656,7 @@ void BlueStore::Onode::put() { ocs->lock.lock(); } bool need_unpin = pinned; - pinned = pinned && nref > 2; // intentionally use > not >= as we have - // +1 due to pinned state + pinned = pinned && nref >= 2; need_unpin = need_unpin && !pinned; if (cached && need_unpin) { if (exists) { @@ -3679,10 +3667,6 @@ void BlueStore::Onode::put() { c->onode_map._remove(oid); } } - // additional decrement for newly unpinned instance - if (need_unpin) { - --nref; - } ocs->lock.unlock(); } auto pn = --put_nref; |