]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Modify maybe_unshare_on_remove
authorAdam Kupczyk <akupczyk@ibm.com>
Mon, 1 Jun 2026 10:50:18 +0000 (10:50 +0000)
committerAdam Kupczyk <akupczyk@ibm.com>
Thu, 9 Jul 2026 09:33:35 +0000 (09:33 +0000)
Use Blob* as key for processing 'expect' shared blobs.
Opens access to bluestore_blob_t.

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
src/os/bluestore/BlueStore.cc

index 18ea2d8497239470e89926400c8ee39d486040f6..df32b4dcbd92ab4ebd0bdf4b86208cc01c38f8a5 100644 (file)
@@ -18349,16 +18349,17 @@ int BlueStore::_maybe_unshare_on_remove(
   // that is not yet loaded! We must have had inspected it to even check nrefs.
   dout(20) << __func__ << " checking for unshareable blobs on " << h
           << " " << h->oid << dendl;
-  map<SharedBlob*,bluestore_extent_ref_map_t> expect;
+  map<const Blob*, bluestore_extent_ref_map_t> expect;
   for (auto& e : h->extent_map.extent_map) {
-    const bluestore_blob_t& b = e.blob->get_blob();
-    SharedBlob *sb = e.blob->get_shared_blob().get();
+    const Blob* B = e.blob.get();
+    const bluestore_blob_t& b = B->get_blob();
+    SharedBlob *sb = B->get_shared_blob().get();
     if (b.is_shared() &&
        sb->loaded &&
        maybe_unshared_blobs.count(sb)) {
       if (b.is_compressed()) {
         b.map(0, b.get_ondisk_size(), [&](uint64_t off, uint64_t len) {
-            expect[sb].get(off, len);
+            expect[B].get(off, len);
             return 0;
           });
         // Do not account second time.
@@ -18366,7 +18367,7 @@ int BlueStore::_maybe_unshare_on_remove(
       } 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[sb].get(off, len);
+           expect[B].get(off, len);
            return 0;
          });
       }
@@ -18376,11 +18377,11 @@ int BlueStore::_maybe_unshare_on_remove(
   // expect has now refs set exactly as .head is using it
   vector<SharedBlob*> unshared_blobs;
   unshared_blobs.reserve(expect.size());
-  for (auto& p : expect) {
-    dout(20) << " ? " << *p.first << " vs " << p.second << dendl;
-    if (p.first->persistent->ref_map == p.second) {
+  for (const auto& [B, expect_refs] : expect) {
+    SharedBlob* sb = B->get_shared_blob().get();
+    dout(20) << __func__ << " ? " << *sb << " vs " << expect_refs << dendl;
+    if (sb->persistent->ref_map == expect_refs) {
       // yup, .head is only one that is using the shared blob now
-      SharedBlob *sb = p.first;
       dout(20) << __func__ << "  unsharing " << *sb << dendl;
       unshared_blobs.push_back(sb);
       txc->unshare_blob(sb);