]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
blk: avoid temporary bptrs on aio paths; use ptr_node instead. 39132/head
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 28 Jan 2021 12:15:56 +0000 (13:15 +0100)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 28 Jan 2021 12:27:20 +0000 (13:27 +0100)
This is a slight optimization for the `HAVE_LIBAIO` paths
of the kernel-based `BlockDevice` implementation.
The overall idea is to squeeze temporary, short-living
instances of `ceph::bufferptr` as `ceph::bufferlist`
actually aggregates `ptr_node` (`bufferptr` with the extra
`next` pointer field to form a list). It can be created
directly and this commit switches to exactly this behavior.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/blk/kernel/KernelDevice.cc

index d93279965970687dd3fbb22cfeedf3fe14238b47..d41cda05b63d470b0eac9e7dc28a8486aa8d91b4 100644 (file)
@@ -958,8 +958,8 @@ int KernelDevice::aio_write(
       ioc->pending_aios.push_back(aio_t(ioc, choose_fd(false, write_hint)));
       ++ioc->num_pending;
       auto& aio = ioc->pending_aios.back();
-      bufferptr p = ceph::buffer::create_small_page_aligned(len);
-      aio.bl.append(std::move(p));
+      aio.bl.push_back(
+        ceph::buffer::ptr_node::create(ceph::buffer::create_small_page_aligned(len)));
       aio.bl.prepare_iov(&aio.iov);
       aio.preadv(off, len);
       ++injecting_crash;
@@ -1092,8 +1092,8 @@ int KernelDevice::aio_read(
     ioc->pending_aios.push_back(aio_t(ioc, fd_directs[WRITE_LIFE_NOT_SET]));
     ++ioc->num_pending;
     aio_t& aio = ioc->pending_aios.back();
-    bufferptr p = ceph::buffer::create_small_page_aligned(len);
-    aio.bl.append(std::move(p));
+    aio.bl.push_back(
+      ceph::buffer::ptr_node::create(ceph::buffer::create_small_page_aligned(len)));
     aio.bl.prepare_iov(&aio.iov);
     aio.preadv(off, len);
     dout(30) << aio << dendl;