diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ec470298ea4..4852c020f6b 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 6beb08754a2..4457dc86cda 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,