Skip to content

Commit 3a7404b

Browse files
ebblakekevmw
authored andcommitted
vhdx: Switch to byte-based calls
We are gradually moving away from sector-based interfaces, towards byte-based. Make the change for the last few sector-based calls into the block layer from the vhdx driver. Ideally, the vhdx driver should switch to doing everything byte-based, but that's a more invasive change that requires a bit more auditing. Signed-off-by: Eric Blake <[email protected]> Reviewed-by: Jeff Cody <[email protected]> Signed-off-by: Kevin Wolf <[email protected]>
1 parent 04a11d8 commit 3a7404b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

block/vhdx.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -1127,9 +1127,9 @@ static coroutine_fn int vhdx_co_readv(BlockDriverState *bs, int64_t sector_num,
11271127
break;
11281128
case PAYLOAD_BLOCK_FULLY_PRESENT:
11291129
qemu_co_mutex_unlock(&s->lock);
1130-
ret = bdrv_co_readv(bs->file,
1131-
sinfo.file_offset >> BDRV_SECTOR_BITS,
1132-
sinfo.sectors_avail, &hd_qiov);
1130+
ret = bdrv_co_preadv(bs->file, sinfo.file_offset,
1131+
sinfo.sectors_avail * BDRV_SECTOR_SIZE,
1132+
&hd_qiov, 0);
11331133
qemu_co_mutex_lock(&s->lock);
11341134
if (ret < 0) {
11351135
goto exit;
@@ -1349,9 +1349,9 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num,
13491349
}
13501350
/* block exists, so we can just overwrite it */
13511351
qemu_co_mutex_unlock(&s->lock);
1352-
ret = bdrv_co_writev(bs->file,
1353-
sinfo.file_offset >> BDRV_SECTOR_BITS,
1354-
sectors_to_write, &hd_qiov);
1352+
ret = bdrv_co_pwritev(bs->file, sinfo.file_offset,
1353+
sectors_to_write * BDRV_SECTOR_SIZE,
1354+
&hd_qiov, 0);
13551355
qemu_co_mutex_lock(&s->lock);
13561356
if (ret < 0) {
13571357
goto error_bat_restore;

0 commit comments

Comments
 (0)