]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/.../cache: ensure cached extents are always aligned
authorSamuel Just <sjust@redhat.com>
Thu, 3 Jul 2025 22:20:34 +0000 (15:20 -0700)
committerSamuel Just <sjust@redhat.com>
Mon, 25 Aug 2025 15:45:39 +0000 (08:45 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/os/seastore/cache.cc
src/crimson/os/seastore/cache.h

index d3581498968eb5068f309a809c2a4001da050fea..97487c8f17a1f0f069828de79c7df1255d381d21 100644 (file)
@@ -1192,7 +1192,8 @@ CachedExtentRef Cache::duplicate_for_write(
     // deepcopy the buffer of exist clean extent beacuse it shares
     // buffer with original clean extent.
     auto bp = i->get_bptr();
-    auto nbp = ceph::bufferptr(bp.c_str(), bp.length());
+    auto nbp = ceph::bufferptr(buffer::create_page_aligned(bp.length()));
+    bp.copy_out(0, bp.length(), nbp.c_str());
     i->set_bptr(std::move(nbp));
 
     t.add_mutated_extent(i);
index 0d6586c7e8110e1e201983f4206dfeecfdbc63a8..a4cedf179650f76d8c61d21484f09a2d979d5b76 100644 (file)
@@ -1227,7 +1227,10 @@ public:
       // shallow copy the buffer from original extent
       auto remap_offset = remap_laddr.get_byte_distance<
        extent_len_t>(original_laddr);
-      auto nbp = ceph::bufferptr(*original_bptr, remap_offset, remap_length);
+
+      auto nbp = ceph::bufferptr(buffer::create_page_aligned(remap_length));
+      original_bptr->copy_out(remap_offset, remap_length, nbp.c_str());
+
       // ExtentPlacementManager::alloc_new_extent will make a new
       // (relative/temp) paddr, so make extent directly
       ext = CachedExtent::make_cached_extent_ref<T>(std::move(nbp));