From: Samuel Just Date: Thu, 3 Jul 2025 22:20:34 +0000 (-0700) Subject: crimson/.../cache: ensure cached extents are always aligned X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fae6dae7c92295d8c2b449817b31034d3486fd0d;p=ceph.git crimson/.../cache: ensure cached extents are always aligned Signed-off-by: Samuel Just --- diff --git a/src/crimson/os/seastore/cache.cc b/src/crimson/os/seastore/cache.cc index d3581498968..97487c8f17a 100644 --- a/src/crimson/os/seastore/cache.cc +++ b/src/crimson/os/seastore/cache.cc @@ -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); diff --git a/src/crimson/os/seastore/cache.h b/src/crimson/os/seastore/cache.h index 0d6586c7e81..a4cedf17965 100644 --- a/src/crimson/os/seastore/cache.h +++ b/src/crimson/os/seastore/cache.h @@ -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(std::move(nbp));