Skip to content

Commit f9f8fca

Browse files
os/bluestore: Add fast-path optimization in Blob::put() by checking nref == 1
Add fast-path optimization in `Blob::put()` for intrusive pointer by checking `nref == 1` using an acquire load before decrementing. Reduces atomic overhead in common last-reference cases, improving performance Signed-off-by: Jaya Prakash <[email protected]>
1 parent 848bc72 commit f9f8fca

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/os/bluestore/BlueStore.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,10 @@ class BlueStore : public ObjectStore,
762762
++nref;
763763
}
764764
void put() {
765+
if (nref.load(std::memory_order_acquire) == 1) {
766+
delete this;
767+
return;
768+
}
765769
if (--nref == 0)
766770
delete this;
767771
}

0 commit comments

Comments
 (0)