qemu-e2k/include/block
Andrey Drobyshev fc6b211f92 block/io: align requests to subcluster_size
When target image is using subclusters, and we align the request during
copy-on-read, it makes sense to align to subcluster_size rather than
cluster_size.  Otherwise we end up with unnecessary allocations.

This commit renames bdrv_round_to_clusters() to bdrv_round_to_subclusters()
and utilizes subcluster_size field of BlockDriverInfo to make necessary
alignments.  It affects copy-on-read as well as mirror job (which is
using bdrv_round_to_clusters()).

This change also fixes the following bug with failing assert (covered by
the test in the subsequent commit):

qemu-img create -f qcow2 base.qcow2 64K
qemu-img create -f qcow2 -o extended_l2=on,backing_file=base.qcow2,backing_fmt=qcow2 img.qcow2 64K
qemu-io -c "write -P 0xaa 0 2K" img.qcow2
qemu-io -C -c "read -P 0x00 2K 62K" img.qcow2

qemu-io: ../block/io.c:1236: bdrv_co_do_copy_on_readv: Assertion `skip_bytes < pnum' failed.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20230711172553.234055-3-andrey.drobyshev@virtuozzo.com>
2023-08-30 07:39:10 -04:00
..
accounting.h block: add accounting for zone append operation 2023-05-15 08:18:10 -04:00
aio_task.h
aio-wait.h aio-wait: avoid AioContext lock in aio_wait_bh_oneshot() 2023-05-10 14:15:13 +02:00
aio.h aio: remove aio_disable_external() API 2023-05-30 17:37:26 +02:00
block_backup.h
block_int-common.h block: remove bdrv_co_io_plug() API 2023-06-01 08:59:24 -04:00
block_int-global-state.h block: Mark bdrv_recurse_can_replace() and callers GRAPH_RDLOCK 2023-05-10 14:16:54 +02:00
block_int-io.h
block_int.h
block-common.h block: add subcluster_size field to BlockDriverInfo 2023-08-30 07:39:10 -04:00
block-copy.h
block-global-state.h block: Call .bdrv_co_create(_opts) unlocked 2023-05-19 19:12:12 +02:00
block-hmp-cmds.h
block-io.h block/io: align requests to subcluster_size 2023-08-30 07:39:10 -04:00
block.h
blockjob_int.h blockjob: Adhere to rate limit even when reentered early 2023-05-19 19:12:12 +02:00
blockjob.h
dirty-bitmap.h
export.h block/export: don't require AioContext lock around blk_exp_ref/unref() 2023-05-30 17:32:02 +02:00
fuse.h
graph-lock.h graph-lock: Unlock the AioContext while polling 2023-06-28 08:46:23 +02:00
nbd.h nbd: Use enum for various negotiation modes 2023-07-19 15:26:13 -05:00
nvme.h
qapi.h block: Mark bdrv_query_block_graph_info() and callers GRAPH_RDLOCK 2023-05-10 14:16:54 +02:00
qdict.h
raw-aio.h block/linux-aio: convert to blk_io_plug_call() API 2023-06-01 07:34:03 -04:00
replication.h
reqlist.h
snapshot.h
thread-pool.h thread-pool: avoid passing the pool parameter every time 2023-04-25 13:17:28 +02:00
throttle-groups.h
write-threshold.h