mirror of https://github.com/xemu-project/xemu.git
block: Drop last of the sector-based aio callbacks
We are gradually moving away from sector-based interfaces, towards byte-based. Now that all drivers with aio callbacks are using the byte-based interfaces, we can remove the sector-based versions. Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
918889b291
commit
edfab6a08b
72
block/io.c
72
block/io.c
|
@ -925,31 +925,14 @@ static int coroutine_fn bdrv_driver_preadv(BlockDriverState *bs,
|
||||||
return drv->bdrv_co_preadv(bs, offset, bytes, qiov, flags);
|
return drv->bdrv_co_preadv(bs, offset, bytes, qiov, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME - no need to calculate these if .bdrv_aio_preadv exists */
|
if (drv->bdrv_aio_preadv) {
|
||||||
sector_num = offset >> BDRV_SECTOR_BITS;
|
|
||||||
nb_sectors = bytes >> BDRV_SECTOR_BITS;
|
|
||||||
|
|
||||||
if (!drv->bdrv_aio_preadv) {
|
|
||||||
assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
|
|
||||||
assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
|
|
||||||
assert((bytes >> BDRV_SECTOR_BITS) <= BDRV_REQUEST_MAX_SECTORS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (drv->bdrv_co_readv) {
|
|
||||||
return drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov);
|
|
||||||
} else {
|
|
||||||
BlockAIOCB *acb;
|
BlockAIOCB *acb;
|
||||||
CoroutineIOCompletion co = {
|
CoroutineIOCompletion co = {
|
||||||
.coroutine = qemu_coroutine_self(),
|
.coroutine = qemu_coroutine_self(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (drv->bdrv_aio_preadv) {
|
|
||||||
acb = drv->bdrv_aio_preadv(bs, offset, bytes, qiov, flags,
|
acb = drv->bdrv_aio_preadv(bs, offset, bytes, qiov, flags,
|
||||||
bdrv_co_io_em_complete, &co);
|
bdrv_co_io_em_complete, &co);
|
||||||
} else {
|
|
||||||
acb = drv->bdrv_aio_readv(bs, sector_num, qiov, nb_sectors,
|
|
||||||
bdrv_co_io_em_complete, &co);
|
|
||||||
}
|
|
||||||
if (acb == NULL) {
|
if (acb == NULL) {
|
||||||
return -EIO;
|
return -EIO;
|
||||||
} else {
|
} else {
|
||||||
|
@ -957,6 +940,16 @@ static int coroutine_fn bdrv_driver_preadv(BlockDriverState *bs,
|
||||||
return co.ret;
|
return co.ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sector_num = offset >> BDRV_SECTOR_BITS;
|
||||||
|
nb_sectors = bytes >> BDRV_SECTOR_BITS;
|
||||||
|
|
||||||
|
assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||||
|
assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||||
|
assert((bytes >> BDRV_SECTOR_BITS) <= BDRV_REQUEST_MAX_SECTORS);
|
||||||
|
assert(drv->bdrv_co_readv);
|
||||||
|
|
||||||
|
return drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs,
|
static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs,
|
||||||
|
@ -981,45 +974,40 @@ static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs,
|
||||||
goto emulate_flags;
|
goto emulate_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME - no need to calculate these if .bdrv_aio_pwritev exists */
|
if (drv->bdrv_aio_pwritev) {
|
||||||
sector_num = offset >> BDRV_SECTOR_BITS;
|
|
||||||
nb_sectors = bytes >> BDRV_SECTOR_BITS;
|
|
||||||
|
|
||||||
if (!drv->bdrv_aio_pwritev) {
|
|
||||||
assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
|
|
||||||
assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
|
|
||||||
assert((bytes >> BDRV_SECTOR_BITS) <= BDRV_REQUEST_MAX_SECTORS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (drv->bdrv_co_writev_flags) {
|
|
||||||
ret = drv->bdrv_co_writev_flags(bs, sector_num, nb_sectors, qiov,
|
|
||||||
flags & bs->supported_write_flags);
|
|
||||||
flags &= ~bs->supported_write_flags;
|
|
||||||
} else if (drv->bdrv_co_writev) {
|
|
||||||
assert(!bs->supported_write_flags);
|
|
||||||
ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);
|
|
||||||
} else {
|
|
||||||
BlockAIOCB *acb;
|
BlockAIOCB *acb;
|
||||||
CoroutineIOCompletion co = {
|
CoroutineIOCompletion co = {
|
||||||
.coroutine = qemu_coroutine_self(),
|
.coroutine = qemu_coroutine_self(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (drv->bdrv_aio_pwritev) {
|
|
||||||
acb = drv->bdrv_aio_pwritev(bs, offset, bytes, qiov,
|
acb = drv->bdrv_aio_pwritev(bs, offset, bytes, qiov,
|
||||||
flags & bs->supported_write_flags,
|
flags & bs->supported_write_flags,
|
||||||
bdrv_co_io_em_complete, &co);
|
bdrv_co_io_em_complete, &co);
|
||||||
flags &= ~bs->supported_write_flags;
|
flags &= ~bs->supported_write_flags;
|
||||||
} else {
|
|
||||||
assert(!bs->supported_write_flags);
|
|
||||||
acb = drv->bdrv_aio_writev(bs, sector_num, qiov, nb_sectors,
|
|
||||||
bdrv_co_io_em_complete, &co);
|
|
||||||
}
|
|
||||||
if (acb == NULL) {
|
if (acb == NULL) {
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
} else {
|
} else {
|
||||||
qemu_coroutine_yield();
|
qemu_coroutine_yield();
|
||||||
ret = co.ret;
|
ret = co.ret;
|
||||||
}
|
}
|
||||||
|
goto emulate_flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
sector_num = offset >> BDRV_SECTOR_BITS;
|
||||||
|
nb_sectors = bytes >> BDRV_SECTOR_BITS;
|
||||||
|
|
||||||
|
assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||||
|
assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||||
|
assert((bytes >> BDRV_SECTOR_BITS) <= BDRV_REQUEST_MAX_SECTORS);
|
||||||
|
|
||||||
|
if (drv->bdrv_co_writev_flags) {
|
||||||
|
ret = drv->bdrv_co_writev_flags(bs, sector_num, nb_sectors, qiov,
|
||||||
|
flags & bs->supported_write_flags);
|
||||||
|
flags &= ~bs->supported_write_flags;
|
||||||
|
} else {
|
||||||
|
assert(drv->bdrv_co_writev);
|
||||||
|
assert(!bs->supported_write_flags);
|
||||||
|
ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);
|
||||||
}
|
}
|
||||||
|
|
||||||
emulate_flags:
|
emulate_flags:
|
||||||
|
|
|
@ -141,15 +141,9 @@ struct BlockDriver {
|
||||||
void (*bdrv_refresh_filename)(BlockDriverState *bs, QDict *options);
|
void (*bdrv_refresh_filename)(BlockDriverState *bs, QDict *options);
|
||||||
|
|
||||||
/* aio */
|
/* aio */
|
||||||
BlockAIOCB *(*bdrv_aio_readv)(BlockDriverState *bs,
|
|
||||||
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
|
|
||||||
BlockCompletionFunc *cb, void *opaque);
|
|
||||||
BlockAIOCB *(*bdrv_aio_preadv)(BlockDriverState *bs,
|
BlockAIOCB *(*bdrv_aio_preadv)(BlockDriverState *bs,
|
||||||
uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags,
|
uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags,
|
||||||
BlockCompletionFunc *cb, void *opaque);
|
BlockCompletionFunc *cb, void *opaque);
|
||||||
BlockAIOCB *(*bdrv_aio_writev)(BlockDriverState *bs,
|
|
||||||
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
|
|
||||||
BlockCompletionFunc *cb, void *opaque);
|
|
||||||
BlockAIOCB *(*bdrv_aio_pwritev)(BlockDriverState *bs,
|
BlockAIOCB *(*bdrv_aio_pwritev)(BlockDriverState *bs,
|
||||||
uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags,
|
uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags,
|
||||||
BlockCompletionFunc *cb, void *opaque);
|
BlockCompletionFunc *cb, void *opaque);
|
||||||
|
|
Loading…
Reference in New Issue