aboutsummaryrefslogtreecommitdiff
path: root/block/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/io.c')
-rw-r--r--block/io.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/block/io.c b/block/io.c
index f702efce84..708690898f 100644
--- a/block/io.c
+++ b/block/io.c
@@ -566,11 +566,11 @@ static void coroutine_fn bdrv_rw_co_entry(void *opaque)
RwCo *rwco = opaque;
if (!rwco->is_write) {
- rwco->ret = bdrv_co_preadv(rwco->child->bs, rwco->offset,
+ rwco->ret = bdrv_co_preadv(rwco->child, rwco->offset,
rwco->qiov->size, rwco->qiov,
rwco->flags);
} else {
- rwco->ret = bdrv_co_pwritev(rwco->child->bs, rwco->offset,
+ rwco->ret = bdrv_co_pwritev(rwco->child, rwco->offset,
rwco->qiov->size, rwco->qiov,
rwco->flags);
}
@@ -1061,10 +1061,11 @@ out:
/*
* Handle a read request in coroutine context
*/
-int coroutine_fn bdrv_co_preadv(BlockDriverState *bs,
+int coroutine_fn bdrv_co_preadv(BdrvChild *child,
int64_t offset, unsigned int bytes, QEMUIOVector *qiov,
BdrvRequestFlags flags)
{
+ BlockDriverState *bs = child->bs;
BlockDriver *drv = bs->drv;
BdrvTrackedRequest req;
@@ -1137,7 +1138,7 @@ static int coroutine_fn bdrv_co_do_readv(BdrvChild *child,
return -EINVAL;
}
- return bdrv_co_preadv(child->bs, sector_num << BDRV_SECTOR_BITS,
+ return bdrv_co_preadv(child, sector_num << BDRV_SECTOR_BITS,
nb_sectors << BDRV_SECTOR_BITS, qiov, flags);
}
@@ -1406,10 +1407,11 @@ fail:
/*
* Handle a write request in coroutine context
*/
-int coroutine_fn bdrv_co_pwritev(BlockDriverState *bs,
+int coroutine_fn bdrv_co_pwritev(BdrvChild *child,
int64_t offset, unsigned int bytes, QEMUIOVector *qiov,
BdrvRequestFlags flags)
{
+ BlockDriverState *bs = child->bs;
BdrvTrackedRequest req;
uint64_t align = bs->bl.request_alignment;
uint8_t *head_buf = NULL;
@@ -1543,7 +1545,7 @@ static int coroutine_fn bdrv_co_do_writev(BdrvChild *child,
return -EINVAL;
}
- return bdrv_co_pwritev(child->bs, sector_num << BDRV_SECTOR_BITS,
+ return bdrv_co_pwritev(child, sector_num << BDRV_SECTOR_BITS,
nb_sectors << BDRV_SECTOR_BITS, qiov, flags);
}
@@ -1555,17 +1557,16 @@ int coroutine_fn bdrv_co_writev(BdrvChild *child, int64_t sector_num,
return bdrv_co_do_writev(child, sector_num, nb_sectors, qiov, 0);
}
-int coroutine_fn bdrv_co_pwrite_zeroes(BlockDriverState *bs,
- int64_t offset, int count,
- BdrvRequestFlags flags)
+int coroutine_fn bdrv_co_pwrite_zeroes(BdrvChild *child, int64_t offset,
+ int count, BdrvRequestFlags flags)
{
- trace_bdrv_co_pwrite_zeroes(bs, offset, count, flags);
+ trace_bdrv_co_pwrite_zeroes(child->bs, offset, count, flags);
- if (!(bs->open_flags & BDRV_O_UNMAP)) {
+ if (!(child->bs->open_flags & BDRV_O_UNMAP)) {
flags &= ~BDRV_REQ_MAY_UNMAP;
}
- return bdrv_co_pwritev(bs, offset, count, NULL,
+ return bdrv_co_pwritev(child, offset, count, NULL,
BDRV_REQ_ZERO_WRITE | flags);
}