From: Adam Kupczyk Date: Mon, 1 Jun 2026 09:01:50 +0000 (+0000) Subject: os/bluestore: Split BlueStore::_do_remove() X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=50a1037da8da6e438d30d8816ecfd04eaaf38be5;p=ceph.git os/bluestore: Split BlueStore::_do_remove() Split BlueStore::_do_remove into 2 parts: - part that removes object (in _do_remove) - part that processes head object and tries to unshare blobs (new function _maybe_unshare_on_remove) No logic changes. Signed-off-by: Adam Kupczyk --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ec470298ea41..4852c020f6b9 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -18325,10 +18325,18 @@ int BlueStore::_do_remove( nogen.hobj.snap = CEPH_NOSNAP; OnodeRef h = c->get_onode(nogen, false); - if (!h || !h->exists) { - return 0; + if (h && h->exists) { + return _maybe_unshare_on_remove(txc, c, h, std::move(maybe_unshared_blobs)); } + return 0; +} +int BlueStore::_maybe_unshare_on_remove( + TransContext *txc, + CollectionRef& c, + OnodeRef& h, + std::set&& maybe_unshared_blobs) +{ //Populate the extent map structure from DB; required for shared blob processing below. h->extent_map.fault_range(db, 0, h->onode.size); // Set maybe_unshared_blobs contains those shared blobs that have all nref=1. diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 6beb08754a23..4457dc86cda2 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -3970,6 +3970,10 @@ private: int _do_remove(TransContext *txc, CollectionRef& c, OnodeRef& o); + int _maybe_unshare_on_remove(TransContext *txc, + CollectionRef& c, + OnodeRef& head_o, + std::set&& maybe_unshared_blobs); int _setattr(TransContext *txc, CollectionRef& c, OnodeRef& o,