blkreplay: Convert to byte-based I/O
The blkreplay driver only forwards the requests it gets, so converting it to byte granularity is trivial. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
eecc77473b
commit
e858a9705c
@ -81,22 +81,22 @@ static void block_request_create(uint64_t reqid, BlockDriverState *bs,
|
|||||||
replay_block_event(req->bh, reqid);
|
replay_block_event(req->bh, reqid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int coroutine_fn blkreplay_co_readv(BlockDriverState *bs,
|
static int coroutine_fn blkreplay_co_preadv(BlockDriverState *bs,
|
||||||
int64_t sector_num, int nb_sectors, QEMUIOVector *qiov)
|
uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags)
|
||||||
{
|
{
|
||||||
uint64_t reqid = request_id++;
|
uint64_t reqid = request_id++;
|
||||||
int ret = bdrv_co_readv(bs->file->bs, sector_num, nb_sectors, qiov);
|
int ret = bdrv_co_preadv(bs->file->bs, offset, bytes, qiov, flags);
|
||||||
block_request_create(reqid, bs, qemu_coroutine_self());
|
block_request_create(reqid, bs, qemu_coroutine_self());
|
||||||
qemu_coroutine_yield();
|
qemu_coroutine_yield();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int coroutine_fn blkreplay_co_writev(BlockDriverState *bs,
|
static int coroutine_fn blkreplay_co_pwritev(BlockDriverState *bs,
|
||||||
int64_t sector_num, int nb_sectors, QEMUIOVector *qiov)
|
uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags)
|
||||||
{
|
{
|
||||||
uint64_t reqid = request_id++;
|
uint64_t reqid = request_id++;
|
||||||
int ret = bdrv_co_writev(bs->file->bs, sector_num, nb_sectors, qiov);
|
int ret = bdrv_co_pwritev(bs->file->bs, offset, bytes, qiov, flags);
|
||||||
block_request_create(reqid, bs, qemu_coroutine_self());
|
block_request_create(reqid, bs, qemu_coroutine_self());
|
||||||
qemu_coroutine_yield();
|
qemu_coroutine_yield();
|
||||||
|
|
||||||
@ -144,8 +144,8 @@ static BlockDriver bdrv_blkreplay = {
|
|||||||
.bdrv_close = blkreplay_close,
|
.bdrv_close = blkreplay_close,
|
||||||
.bdrv_getlength = blkreplay_getlength,
|
.bdrv_getlength = blkreplay_getlength,
|
||||||
|
|
||||||
.bdrv_co_readv = blkreplay_co_readv,
|
.bdrv_co_preadv = blkreplay_co_preadv,
|
||||||
.bdrv_co_writev = blkreplay_co_writev,
|
.bdrv_co_pwritev = blkreplay_co_pwritev,
|
||||||
|
|
||||||
.bdrv_co_pwrite_zeroes = blkreplay_co_pwrite_zeroes,
|
.bdrv_co_pwrite_zeroes = blkreplay_co_pwrite_zeroes,
|
||||||
.bdrv_co_discard = blkreplay_co_discard,
|
.bdrv_co_discard = blkreplay_co_discard,
|
||||||
|
Loading…
Reference in New Issue
Block a user