diff options
author | Andrey Drobyshev <andrey.drobyshev@virtuozzo.com> | 2023-07-11 20:25:52 +0300 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2023-08-30 07:39:10 -0400 |
commit | fc6b211f920a68f4c9c8db91ccc35ca95fe6683a (patch) | |
tree | 6a7fb31cd09918d1580f3638614846dca146e182 /scripts/coverage | |
parent | c54483b6f45a0c84e230728a1a9e7adf90345e15 (diff) | |
download | qemu-fc6b211f920a68f4c9c8db91ccc35ca95fe6683a.zip qemu-fc6b211f920a68f4c9c8db91ccc35ca95fe6683a.tar.gz qemu-fc6b211f920a68f4c9c8db91ccc35ca95fe6683a.tar.bz2 |
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>
Diffstat (limited to 'scripts/coverage')
0 files changed, 0 insertions, 0 deletions