mirror_qemu/include/block
Stefan Hajnoczi e8b6535533 block: add BDRV_REQ_REGISTERED_BUF request flag
Block drivers may optimize I/O requests accessing buffers previously
registered with bdrv_register_buf(). Checking whether all elements of a
request's QEMUIOVector are within previously registered buffers is
expensive, so we need a hint from the user to avoid costly checks.

Add a BDRV_REQ_REGISTERED_BUF request flag to indicate that all
QEMUIOVector elements in an I/O request are known to be within
previously registered buffers.

Always pass the flag through to driver read/write functions. There is
little harm in passing the flag to a driver that does not use it.
Passing the flag to drivers avoids changes across many block drivers.
Filter drivers would need to explicitly support the flag and pass
through to their children when the children support it. That's a lot of
code changes and it's hard to remember to do that everywhere, leading to
silent reduced performance when the flag is accidentally dropped.

The only problematic scenario with the approach in this patch is when a
driver passes the flag through to internal I/O requests that don't use
the same I/O buffer. In that case the hint may be set when it should
actually be clear. This is a rare case though so the risk is low.

Some drivers have assert(!flags), which no longer works when
BDRV_REQ_REGISTERED_BUF is passed in. These assertions aren't very
useful anyway since the functions are called almost exclusively by
bdrv_driver_preadv/pwritev() so if we get flags handling right there
then the assertion is not needed.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20221013185908.1297568-7-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2022-10-26 14:56:42 -04:00
..
accounting.h block: pass OnOffAuto instead of bool to block_acct_setup() 2022-09-30 18:02:30 +02:00
aio-wait.h aio-wait.h: introduce AIO_WAIT_WHILE_UNLOCKED 2022-10-07 12:11:41 +02:00
aio.h util/event-loop-base: Introduce options to set the thread pool size 2022-05-09 10:43:23 +01:00
aio_task.h block: introduce aio task pool 2019-10-10 10:56:17 +02:00
block-common.h block: add BDRV_REQ_REGISTERED_BUF request flag 2022-10-26 14:56:42 -04:00
block-copy.h block/block-copy: block_copy(): add timeout_ns parameter 2022-06-29 10:56:12 +03:00
block-global-state.h block: pass size to bdrv_unregister_buf() 2022-10-26 14:56:42 -04:00
block-hmp-cmds.h Clean up header guards that don't match their file name 2022-05-11 16:49:06 +02:00
block-io.h block: move bdrv_qiov_is_aligned to file-posix 2022-09-30 18:43:44 +02:00
block.h include/block/block: split header into I/O and global state API 2022-03-04 18:18:25 +01:00
block_backup.h block/backup: drop unused synchronization interface 2018-12-14 11:52:40 +01:00
block_int-common.h block: use BdrvRequestFlags type for supported flag fields 2022-10-26 14:56:42 -04:00
block_int-global-state.h Clean up decorations and whitespace around header guards 2022-05-11 16:50:32 +02:00
block_int-io.h block: make serializing requests functions 'void' 2022-09-30 18:43:44 +02:00
block_int.h include/block/block_int: split header into I/O and global state API 2022-03-04 18:18:25 +01:00
blockjob.h blockjob: remove unused functions 2022-10-07 12:11:41 +02:00
blockjob_int.h include/block/blockjob_int.h: split header into I/O and GS API 2022-03-04 18:18:25 +01:00
dirty-bitmap.h block/dirty-bitmap: introduce bdrv_dirty_bitmap_status() 2022-03-07 09:33:30 +01:00
export.h block/export: Move blk to BlockExport 2020-10-02 15:46:40 +02:00
fuse.h fuse: Allow exporting BDSs via FUSE 2020-12-11 17:52:39 +01:00
nbd.h nbd: remove incorrect coroutine_fn annotations 2022-10-07 12:11:40 +02:00
nvme.h nvme: Fix misleading macro when mixed with ternary operator 2022-07-15 10:40:33 +02:00
qapi.h qapi: Allow getting flat output from 'query-named-block-nodes' 2020-02-20 16:43:42 +01:00
qdict.h include: move qdict_{crumple,flatten} declarations 2022-04-21 17:03:51 +04:00
raw-aio.h linux-aio: add `dev_max_batch` parameter to laio_io_unplug() 2021-11-02 13:03:35 +01:00
replication.h replication: move include out of root directory 2021-05-26 14:49:46 +02:00
reqlist.h block/reqlist: add reqlist_wait_all() 2022-03-07 09:33:30 +01:00
snapshot.h include/block/snapshot: global state API + assertions 2022-03-04 18:18:25 +01:00
thread-pool.h util/event-loop-base: Introduce options to set the thread pool size 2022-05-09 10:43:23 +01:00
throttle-groups.h block/throttle-groups: throttle_group_co_io_limits_intercept(): 64bit bytes 2021-02-03 08:14:00 -06:00
write-threshold.h write-threshold: deal with includes 2021-05-14 16:14:10 +02:00