From 96a1a2e25dc382745812b5fff59ec76e85248958 Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Tue, 2 Jun 2026 05:59:39 +0000 Subject: [PATCH] os/bluestore: Make maybe_unshare_extents use allocations Blob is tracking whole AUs in SharedBlob tracker. But the extents may account for just a portion of AUs. We need to compare what would Blob release against SharedBlob tracker. Signed-off-by: Adam Kupczyk --- src/os/bluestore/BlueStore.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index df32b4dcbd9..66846ce8010 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -18365,11 +18365,12 @@ int BlueStore::_maybe_unshare_on_remove( // Do not account second time. maybe_unshared_blobs.erase(sb); } else { - // todo: it seems to be an overkill to go through map() - b.map(e.blob_offset, e.length, [&](uint64_t off, uint64_t len) { - expect[B].get(off, len); - return 0; - }); + for (const auto& e: b.get_extents()) { + if (e.is_valid()) { + expect[B].get(e.offset, e.length); + } + } + maybe_unshared_blobs.erase(sb); } } }