blkio: implement BDRV_REQ_REGISTERED_BUF optimization
commitc5640b3e2f1146e8eea9f9f62db87713388d8bc8
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 13 Oct 2022 18:59:07 +0000 (13 14:59 -0400)
committerStefan Hajnoczi <stefanha@redhat.com>
Wed, 26 Oct 2022 18:56:42 +0000 (26 14:56 -0400)
tree08b85c44df71cb9965b484860f1069f7c589a198
parent701bff24deba59a095c6b5cade15e764d56909f6
blkio: implement BDRV_REQ_REGISTERED_BUF optimization

Avoid bounce buffers when QEMUIOVector elements are within previously
registered bdrv_register_buf() buffers.

The idea is that emulated storage controllers will register guest RAM
using bdrv_register_buf() and set the BDRV_REQ_REGISTERED_BUF on I/O
requests. Therefore no blkio_map_mem_region() calls are necessary in the
performance-critical I/O code path.

This optimization doesn't apply if the I/O buffer is internally
allocated by QEMU (e.g. qcow2 metadata). There we still take the slow
path because BDRV_REQ_REGISTERED_BUF is not set.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-id: 20221013185908.1297568-13-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/blkio.c