Fix VHDX qemu-iotests 033 failure
cover Fix VHDX qemu-iotests 033 failure
Kevin Wolf (2):
blkdebug: Add bdrv_truncate()
vhdx: Fix zero-fill iov length
block/blkdebug.c | 6 ++++++ block/vhdx.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/2 blkdebug: Add bdrv_truncate()
This is, amongst others, required for qemu-iotests 033 to run as intended on VHDX, which uses explicit bdrv_truncate() calls to bs->file when allocating new blocks.
--- block/blkdebug.c | 6 ++++++ 1 file changed, 6 insertions(+)
block/blkdebug.c +6 -0
@@ -721,6 +721,11 @@ static int64_t blkdebug_getlength(BlockDriverState *bs)return bdrv_getlength (bs->file); } +static int blkdebug_truncate (BlockDriverState *bs,int64_t offset) +{ +return bdrv_truncate (bs->file, offset); +} +static void blkdebug_refresh_filename (BlockDriverState *bs) {QDict *opts;
@@ -779,6 +784,7 @@ static BlockDriver bdrv_blkdebug = { .bdrv_file_open = blkdebug_open, .bdrv_close = blkdebug_close, .bdrv_getlength = blkdebug_getlength, + .bdrv_truncate = blkdebug_truncate, .bdrv_refresh_filename = blkdebug_refresh_filename, .bdrv_aio_readv = blkdebug_aio_readv,
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 1/2] blkdebug: Add bdrv_truncate()
Quoted 36 lines · Kevin Wolf
This is, amongst others, required for qemu-iotests 033 to run as intended on VHDX, which uses explicit
bdrv_truncate()calls tobs->filewhen allocating new blocks.Signed-off-by Kevin Wolf <[email protected]>--- block/blkdebug.c | 6 ++++++ 1 file changed, 6 insertions(+)block/blkdebug.c +6
-0@@ -721,6 +721,11 @@ static int64_t blkdebug_getlength(BlockDriverState *bs)return bdrv_getlength (bs->file); } +static int blkdebug_truncate (BlockDriverState *bs,int64_t offset) +{ +return bdrv_truncate (bs->file, offset); +} +static void blkdebug_refresh_filename (BlockDriverState *bs) {QDict *opts;@@ -779,6 +784,7 @@ static BlockDriver bdrv_blkdebug = { .bdrv_file_open = blkdebug_open, .bdrv_close = blkdebug_close, .bdrv_getlength = blkdebug_getlength, + .bdrv_truncate = blkdebug_truncate, .bdrv_refresh_filename = blkdebug_refresh_filename, .bdrv_aio_readv = blkdebug_aio_readv,Signature · 1 line
1.8.3.1
PATCH 2/2 vhdx: Fix zero-fill iov length
In reply to Kevin WolfFix the length of the zero-fill for the back, which was accidentally using the same value as for the front. This is caught by qemu-iotests 033.
For consistency, change the code for the front as well to use the length stored in the iov (it is the same value, copied four lines above).
--- block/vhdx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block/vhdx.c +2 -2
@@ -1269,7 +1269,7 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, iov1.iov_base =qemu_blockalign (bs, iov1.iov_len);memset (iov1.iov_base,0 , iov1.iov_len);qemu_iovec_concat_iov (&hd_qiov, &iov1,1 ,0 , - sinfo.block_offset); + iov1.iov_len); sectors_to_write += iov1.iov_len >>BDRV_SECTOR_BITS ; }
@@ -1285,7 +1285,7 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, iov2.iov_base =qemu_blockalign (bs, iov2.iov_len);memset (iov2.iov_base,0 , iov2.iov_len);qemu_iovec_concat_iov (&hd_qiov, &iov2,1 ,0 , - sinfo.block_offset); + iov2.iov_len); sectors_to_write += iov2.iov_len >>BDRV_SECTOR_BITS ; } }
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 2/2] vhdx: Fix zero-fill iov length
Quoted 17 lines · Kevin Wolf
Fix the length of the zero-fill for the back, which was accidentally using the same value as for the front. This is caught by qemu-iotests 033.
For consistency, change the code for the front as well to use the length stored in the iov (it is the same value, copied four lines above).
Signed-off-by Kevin Wolf <[email protected]>--- block/vhdx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)block/vhdx.c +0
-0
block/vhdx.c static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, · line 1272
Quoted 5 lines
block/vhdx.c +1
-1@@ -1269,7 +1269,7 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, iov1.iov_base =qemu_blockalign (bs, iov1.iov_len);memset (iov1.iov_base,0 , iov1.iov_len);qemu_iovec_concat_iov (&hd_qiov, &iov1,1 ,0 , - sinfo.block_offset); + iov1.iov_len);
Better form here, although should be identical
block/vhdx.c static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, · line 1288
Quoted 9 lines
block/vhdx.c +1
-1sectors_to_write += iov1.iov_len >>BDRV_SECTOR_BITS ; }@@ -1285,7 +1285,7 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, iov2.iov_base =qemu_blockalign (bs, iov2.iov_len);memset (iov2.iov_base,0 , iov2.iov_len);qemu_iovec_concat_iov (&hd_qiov, &iov2,1 ,0 , - sinfo.block_offset); + iov2.iov_len);
Definite bug fix here
Quoted 6 lines
block/vhdx.c +0
-0sectors_to_write += iov2.iov_len >>BDRV_SECTOR_BITS ; } }Signature · 1 line
1.8.3.1