From a03ef88f77af045a2eb9629b5ce774a3fb973c5e Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 20 Jun 2016 21:31:46 +0200 Subject: block: Convert bdrv_co_preadv/pwritev to BdrvChild This is the final patch for converting the common I/O path to take a BdrvChild parameter instead of BlockDriverState. The completion of this conversion means that all users that perform I/O on an image need to actually hold a reference (in the form of BdrvChild, possible as part of a BlockBackend) to that image. This also protects against inconsistent use of BlockBackend vs. BlockDriverState functions because direct use of a BlockDriverState isn't possible any more and blk->root is private for block-backends.c. In addition, we can now distinguish different users in the I/O path, and the future op blockers work is going to add assertions based on permissions stored in BdrvChild. Signed-off-by: Kevin Wolf Acked-by: Stefan Hajnoczi --- block/vmdk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'block/vmdk.c') diff --git a/block/vmdk.c b/block/vmdk.c index ae70b63d5a..d73f4314ba 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1369,7 +1369,7 @@ static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset, } write_offset = cluster_offset + offset_in_cluster, - ret = bdrv_co_pwritev(extent->file->bs, write_offset, n_bytes, + ret = bdrv_co_pwritev(extent->file, write_offset, n_bytes, &local_qiov, 0); write_end_sector = DIV_ROUND_UP(write_offset + n_bytes, BDRV_SECTOR_SIZE); @@ -1407,7 +1407,7 @@ static int vmdk_read_extent(VmdkExtent *extent, int64_t cluster_offset, if (!extent->compressed) { - ret = bdrv_co_preadv(extent->file->bs, + ret = bdrv_co_preadv(extent->file, cluster_offset + offset_in_cluster, bytes, qiov, 0); if (ret < 0) { @@ -1497,7 +1497,7 @@ vmdk_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); - ret = bdrv_co_preadv(bs->backing->bs, offset, n_bytes, + ret = bdrv_co_preadv(bs->backing, offset, n_bytes, &local_qiov, 0); if (ret < 0) { goto fail; -- cgit v1.2.3