From: Jason Dillaman Date: Thu, 4 Feb 2021 16:17:48 +0000 (-0500) Subject: librbd/io: conditionally disable move optimization X-Git-Tag: v16.2.0~185^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6fee593147e4b4f413072ff15a1c32c070b64d38;p=ceph.git librbd/io: conditionally disable move optimization If the requested write length does not match the provided bufferlist length, disable the move optimization and instead fallback to creating a new sub-bufferlist for the object request. Fixes: https://tracker.ceph.com/issues/49173 Signed-off-by: Jason Dillaman (cherry picked from commit 8dbb4a3d971d9a48c171f161f531956dd0030403) --- diff --git a/src/librbd/io/ImageRequest.cc b/src/librbd/io/ImageRequest.cc index 2b4212df9dec..5f8d2f0da39b 100644 --- a/src/librbd/io/ImageRequest.cc +++ b/src/librbd/io/ImageRequest.cc @@ -527,7 +527,8 @@ ObjectDispatchSpec *ImageWriteRequest::create_object_request( I &image_ctx = this->m_image_ctx; bufferlist bl; - if (single_extent && object_extent.buffer_extents.size() == 1) { + if (single_extent && object_extent.buffer_extents.size() == 1 && + m_bl.length() == object_extent.length) { // optimization for single object/buffer extent writes bl = std::move(m_bl); } else {