mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-08 16:07:39 -06:00
block: use the request length for iov alignment
An iov length needs to be aligned to the logical block size, which may be larger than the memory alignment. Tested-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Keith Busch <kbusch@kernel.org> Message-Id: <20220929200523.3218710-3-kbusch@meta.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
a7c5f67a78
commit
25474d90aa
1 changed files with 2 additions and 1 deletions
|
@ -2068,13 +2068,14 @@ static bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
size_t alignment = bdrv_min_mem_align(bs);
|
size_t alignment = bdrv_min_mem_align(bs);
|
||||||
|
size_t len = bs->bl.request_alignment;
|
||||||
IO_CODE();
|
IO_CODE();
|
||||||
|
|
||||||
for (i = 0; i < qiov->niov; i++) {
|
for (i = 0; i < qiov->niov; i++) {
|
||||||
if ((uintptr_t) qiov->iov[i].iov_base % alignment) {
|
if ((uintptr_t) qiov->iov[i].iov_base % alignment) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (qiov->iov[i].iov_len % alignment) {
|
if (qiov->iov[i].iov_len % len) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue