block: Rename BlockDriverAIOCB* to BlockAIOCB*

I'll use BlockDriverAIOCB with block backends shortly, and the name is
going to fit badly there.  It's a block layer thing anyway, not just a
block driver thing.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Markus Armbruster 2014-10-07 13:59:14 +02:00 committed by Kevin Wolf
parent fa1d36df74
commit 7c84b1b831
34 changed files with 265 additions and 265 deletions

View file

@ -72,7 +72,7 @@ typedef struct BlkMigBlock {
int nr_sectors; int nr_sectors;
struct iovec iov; struct iovec iov;
QEMUIOVector qiov; QEMUIOVector qiov;
BlockDriverAIOCB *aiocb; BlockAIOCB *aiocb;
/* Protected by block migration lock. */ /* Protected by block migration lock. */
int ret; int ret;

124
block.c
View file

@ -61,10 +61,10 @@ struct BdrvDirtyBitmap {
#define COROUTINE_POOL_RESERVATION 64 /* number of coroutines to reserve */ #define COROUTINE_POOL_RESERVATION 64 /* number of coroutines to reserve */
static void bdrv_dev_change_media_cb(BlockDriverState *bs, bool load); static void bdrv_dev_change_media_cb(BlockDriverState *bs, bool load);
static BlockDriverAIOCB *bdrv_aio_readv_em(BlockDriverState *bs, static BlockAIOCB *bdrv_aio_readv_em(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
static BlockDriverAIOCB *bdrv_aio_writev_em(BlockDriverState *bs, static BlockAIOCB *bdrv_aio_writev_em(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
static int coroutine_fn bdrv_co_readv_em(BlockDriverState *bs, static int coroutine_fn bdrv_co_readv_em(BlockDriverState *bs,
@ -79,14 +79,14 @@ static int coroutine_fn bdrv_co_do_preadv(BlockDriverState *bs,
static int coroutine_fn bdrv_co_do_pwritev(BlockDriverState *bs, static int coroutine_fn bdrv_co_do_pwritev(BlockDriverState *bs,
int64_t offset, unsigned int bytes, QEMUIOVector *qiov, int64_t offset, unsigned int bytes, QEMUIOVector *qiov,
BdrvRequestFlags flags); BdrvRequestFlags flags);
static BlockDriverAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs, static BlockAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs,
int64_t sector_num, int64_t sector_num,
QEMUIOVector *qiov, QEMUIOVector *qiov,
int nb_sectors, int nb_sectors,
BdrvRequestFlags flags, BdrvRequestFlags flags,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque, void *opaque,
bool is_write); bool is_write);
static void coroutine_fn bdrv_co_do_rw(void *opaque); static void coroutine_fn bdrv_co_do_rw(void *opaque);
static int coroutine_fn bdrv_co_do_write_zeroes(BlockDriverState *bs, static int coroutine_fn bdrv_co_do_write_zeroes(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, BdrvRequestFlags flags); int64_t sector_num, int nb_sectors, BdrvRequestFlags flags);
@ -4413,9 +4413,9 @@ int bdrv_get_backing_file_depth(BlockDriverState *bs)
/**************************************************************/ /**************************************************************/
/* async I/Os */ /* async I/Os */
BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num, BlockAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num,
QEMUIOVector *qiov, int nb_sectors, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
trace_bdrv_aio_readv(bs, sector_num, nb_sectors, opaque); trace_bdrv_aio_readv(bs, sector_num, nb_sectors, opaque);
@ -4423,9 +4423,9 @@ BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num,
cb, opaque, false); cb, opaque, false);
} }
BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num, BlockAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num,
QEMUIOVector *qiov, int nb_sectors, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
trace_bdrv_aio_writev(bs, sector_num, nb_sectors, opaque); trace_bdrv_aio_writev(bs, sector_num, nb_sectors, opaque);
@ -4433,7 +4433,7 @@ BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num,
cb, opaque, true); cb, opaque, true);
} }
BlockDriverAIOCB *bdrv_aio_write_zeroes(BlockDriverState *bs, BlockAIOCB *bdrv_aio_write_zeroes(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, BdrvRequestFlags flags, int64_t sector_num, int nb_sectors, BdrvRequestFlags flags,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -4627,7 +4627,7 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, int num_reqs)
return 0; return 0;
} }
void bdrv_aio_cancel(BlockDriverAIOCB *acb) void bdrv_aio_cancel(BlockAIOCB *acb)
{ {
qemu_aio_ref(acb); qemu_aio_ref(acb);
bdrv_aio_cancel_async(acb); bdrv_aio_cancel_async(acb);
@ -4646,7 +4646,7 @@ void bdrv_aio_cancel(BlockDriverAIOCB *acb)
/* Async version of aio cancel. The caller is not blocked if the acb implements /* Async version of aio cancel. The caller is not blocked if the acb implements
* cancel_async, otherwise we do nothing and let the request normally complete. * cancel_async, otherwise we do nothing and let the request normally complete.
* In either case the completion callback must be called. */ * In either case the completion callback must be called. */
void bdrv_aio_cancel_async(BlockDriverAIOCB *acb) void bdrv_aio_cancel_async(BlockAIOCB *acb)
{ {
if (acb->aiocb_info->cancel_async) { if (acb->aiocb_info->cancel_async) {
acb->aiocb_info->cancel_async(acb); acb->aiocb_info->cancel_async(acb);
@ -4656,23 +4656,23 @@ void bdrv_aio_cancel_async(BlockDriverAIOCB *acb)
/**************************************************************/ /**************************************************************/
/* async block device emulation */ /* async block device emulation */
typedef struct BlockDriverAIOCBSync { typedef struct BlockAIOCBSync {
BlockDriverAIOCB common; BlockAIOCB common;
QEMUBH *bh; QEMUBH *bh;
int ret; int ret;
/* vector translation state */ /* vector translation state */
QEMUIOVector *qiov; QEMUIOVector *qiov;
uint8_t *bounce; uint8_t *bounce;
int is_write; int is_write;
} BlockDriverAIOCBSync; } BlockAIOCBSync;
static const AIOCBInfo bdrv_em_aiocb_info = { static const AIOCBInfo bdrv_em_aiocb_info = {
.aiocb_size = sizeof(BlockDriverAIOCBSync), .aiocb_size = sizeof(BlockAIOCBSync),
}; };
static void bdrv_aio_bh_cb(void *opaque) static void bdrv_aio_bh_cb(void *opaque)
{ {
BlockDriverAIOCBSync *acb = opaque; BlockAIOCBSync *acb = opaque;
if (!acb->is_write && acb->ret >= 0) { if (!acb->is_write && acb->ret >= 0) {
qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size); qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size);
@ -4684,16 +4684,16 @@ static void bdrv_aio_bh_cb(void *opaque)
qemu_aio_unref(acb); qemu_aio_unref(acb);
} }
static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs, static BlockAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs,
int64_t sector_num, int64_t sector_num,
QEMUIOVector *qiov, QEMUIOVector *qiov,
int nb_sectors, int nb_sectors,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque, void *opaque,
int is_write) int is_write)
{ {
BlockDriverAIOCBSync *acb; BlockAIOCBSync *acb;
acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque); acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque);
acb->is_write = is_write; acb->is_write = is_write;
@ -4715,14 +4715,14 @@ static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs,
return &acb->common; return &acb->common;
} }
static BlockDriverAIOCB *bdrv_aio_readv_em(BlockDriverState *bs, static BlockAIOCB *bdrv_aio_readv_em(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
return bdrv_aio_rw_vector(bs, sector_num, qiov, nb_sectors, cb, opaque, 0); return bdrv_aio_rw_vector(bs, sector_num, qiov, nb_sectors, cb, opaque, 0);
} }
static BlockDriverAIOCB *bdrv_aio_writev_em(BlockDriverState *bs, static BlockAIOCB *bdrv_aio_writev_em(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -4730,21 +4730,21 @@ static BlockDriverAIOCB *bdrv_aio_writev_em(BlockDriverState *bs,
} }
typedef struct BlockDriverAIOCBCoroutine { typedef struct BlockAIOCBCoroutine {
BlockDriverAIOCB common; BlockAIOCB common;
BlockRequest req; BlockRequest req;
bool is_write; bool is_write;
bool *done; bool *done;
QEMUBH* bh; QEMUBH* bh;
} BlockDriverAIOCBCoroutine; } BlockAIOCBCoroutine;
static const AIOCBInfo bdrv_em_co_aiocb_info = { static const AIOCBInfo bdrv_em_co_aiocb_info = {
.aiocb_size = sizeof(BlockDriverAIOCBCoroutine), .aiocb_size = sizeof(BlockAIOCBCoroutine),
}; };
static void bdrv_co_em_bh(void *opaque) static void bdrv_co_em_bh(void *opaque)
{ {
BlockDriverAIOCBCoroutine *acb = opaque; BlockAIOCBCoroutine *acb = opaque;
acb->common.cb(acb->common.opaque, acb->req.error); acb->common.cb(acb->common.opaque, acb->req.error);
@ -4755,7 +4755,7 @@ static void bdrv_co_em_bh(void *opaque)
/* Invoke bdrv_co_do_readv/bdrv_co_do_writev */ /* Invoke bdrv_co_do_readv/bdrv_co_do_writev */
static void coroutine_fn bdrv_co_do_rw(void *opaque) static void coroutine_fn bdrv_co_do_rw(void *opaque)
{ {
BlockDriverAIOCBCoroutine *acb = opaque; BlockAIOCBCoroutine *acb = opaque;
BlockDriverState *bs = acb->common.bs; BlockDriverState *bs = acb->common.bs;
if (!acb->is_write) { if (!acb->is_write) {
@ -4770,17 +4770,17 @@ static void coroutine_fn bdrv_co_do_rw(void *opaque)
qemu_bh_schedule(acb->bh); qemu_bh_schedule(acb->bh);
} }
static BlockDriverAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs, static BlockAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs,
int64_t sector_num, int64_t sector_num,
QEMUIOVector *qiov, QEMUIOVector *qiov,
int nb_sectors, int nb_sectors,
BdrvRequestFlags flags, BdrvRequestFlags flags,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque, void *opaque,
bool is_write) bool is_write)
{ {
Coroutine *co; Coroutine *co;
BlockDriverAIOCBCoroutine *acb; BlockAIOCBCoroutine *acb;
acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);
acb->req.sector = sector_num; acb->req.sector = sector_num;
@ -4797,7 +4797,7 @@ static BlockDriverAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs,
static void coroutine_fn bdrv_aio_flush_co_entry(void *opaque) static void coroutine_fn bdrv_aio_flush_co_entry(void *opaque)
{ {
BlockDriverAIOCBCoroutine *acb = opaque; BlockAIOCBCoroutine *acb = opaque;
BlockDriverState *bs = acb->common.bs; BlockDriverState *bs = acb->common.bs;
acb->req.error = bdrv_co_flush(bs); acb->req.error = bdrv_co_flush(bs);
@ -4805,13 +4805,13 @@ static void coroutine_fn bdrv_aio_flush_co_entry(void *opaque)
qemu_bh_schedule(acb->bh); qemu_bh_schedule(acb->bh);
} }
BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs, BlockAIOCB *bdrv_aio_flush(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
trace_bdrv_aio_flush(bs, opaque); trace_bdrv_aio_flush(bs, opaque);
Coroutine *co; Coroutine *co;
BlockDriverAIOCBCoroutine *acb; BlockAIOCBCoroutine *acb;
acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);
@ -4823,7 +4823,7 @@ BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs,
static void coroutine_fn bdrv_aio_discard_co_entry(void *opaque) static void coroutine_fn bdrv_aio_discard_co_entry(void *opaque)
{ {
BlockDriverAIOCBCoroutine *acb = opaque; BlockAIOCBCoroutine *acb = opaque;
BlockDriverState *bs = acb->common.bs; BlockDriverState *bs = acb->common.bs;
acb->req.error = bdrv_co_discard(bs, acb->req.sector, acb->req.nb_sectors); acb->req.error = bdrv_co_discard(bs, acb->req.sector, acb->req.nb_sectors);
@ -4831,12 +4831,12 @@ static void coroutine_fn bdrv_aio_discard_co_entry(void *opaque)
qemu_bh_schedule(acb->bh); qemu_bh_schedule(acb->bh);
} }
BlockDriverAIOCB *bdrv_aio_discard(BlockDriverState *bs, BlockAIOCB *bdrv_aio_discard(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, int64_t sector_num, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
Coroutine *co; Coroutine *co;
BlockDriverAIOCBCoroutine *acb; BlockAIOCBCoroutine *acb;
trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque); trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque);
@ -4863,7 +4863,7 @@ void bdrv_init_with_whitelist(void)
void *qemu_aio_get(const AIOCBInfo *aiocb_info, BlockDriverState *bs, void *qemu_aio_get(const AIOCBInfo *aiocb_info, BlockDriverState *bs,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
BlockDriverAIOCB *acb; BlockAIOCB *acb;
acb = g_slice_alloc(aiocb_info->aiocb_size); acb = g_slice_alloc(aiocb_info->aiocb_size);
acb->aiocb_info = aiocb_info; acb->aiocb_info = aiocb_info;
@ -4876,13 +4876,13 @@ void *qemu_aio_get(const AIOCBInfo *aiocb_info, BlockDriverState *bs,
void qemu_aio_ref(void *p) void qemu_aio_ref(void *p)
{ {
BlockDriverAIOCB *acb = p; BlockAIOCB *acb = p;
acb->refcnt++; acb->refcnt++;
} }
void qemu_aio_unref(void *p) void qemu_aio_unref(void *p)
{ {
BlockDriverAIOCB *acb = p; BlockAIOCB *acb = p;
assert(acb->refcnt > 0); assert(acb->refcnt > 0);
if (--acb->refcnt == 0) { if (--acb->refcnt == 0) {
g_slice_free1(acb->aiocb_info->aiocb_size, acb); g_slice_free1(acb->aiocb_info->aiocb_size, acb);
@ -4912,7 +4912,7 @@ static int coroutine_fn bdrv_co_io_em(BlockDriverState *bs, int64_t sector_num,
CoroutineIOCompletion co = { CoroutineIOCompletion co = {
.coroutine = qemu_coroutine_self(), .coroutine = qemu_coroutine_self(),
}; };
BlockDriverAIOCB *acb; BlockAIOCB *acb;
if (is_write) { if (is_write) {
acb = bs->drv->bdrv_aio_writev(bs, sector_num, iov, nb_sectors, acb = bs->drv->bdrv_aio_writev(bs, sector_num, iov, nb_sectors,
@ -4978,7 +4978,7 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
if (bs->drv->bdrv_co_flush_to_disk) { if (bs->drv->bdrv_co_flush_to_disk) {
ret = bs->drv->bdrv_co_flush_to_disk(bs); ret = bs->drv->bdrv_co_flush_to_disk(bs);
} else if (bs->drv->bdrv_aio_flush) { } else if (bs->drv->bdrv_aio_flush) {
BlockDriverAIOCB *acb; BlockAIOCB *acb;
CoroutineIOCompletion co = { CoroutineIOCompletion co = {
.coroutine = qemu_coroutine_self(), .coroutine = qemu_coroutine_self(),
}; };
@ -5153,7 +5153,7 @@ int coroutine_fn bdrv_co_discard(BlockDriverState *bs, int64_t sector_num,
if (bs->drv->bdrv_co_discard) { if (bs->drv->bdrv_co_discard) {
ret = bs->drv->bdrv_co_discard(bs, sector_num, num); ret = bs->drv->bdrv_co_discard(bs, sector_num, num);
} else { } else {
BlockDriverAIOCB *acb; BlockAIOCB *acb;
CoroutineIOCompletion co = { CoroutineIOCompletion co = {
.coroutine = qemu_coroutine_self(), .coroutine = qemu_coroutine_self(),
}; };
@ -5279,7 +5279,7 @@ int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
return -ENOTSUP; return -ENOTSUP;
} }
BlockDriverAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs,
unsigned long int req, void *buf, unsigned long int req, void *buf,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {

View file

@ -86,7 +86,7 @@ typedef enum {
} ARCHIPCmd; } ARCHIPCmd;
typedef struct ArchipelagoAIOCB { typedef struct ArchipelagoAIOCB {
BlockDriverAIOCB common; BlockAIOCB common;
QEMUBH *bh; QEMUBH *bh;
struct BDRVArchipelagoState *s; struct BDRVArchipelagoState *s;
QEMUIOVector *qiov; QEMUIOVector *qiov;
@ -856,13 +856,13 @@ err_exit:
return ret; return ret;
} }
static BlockDriverAIOCB *qemu_archipelago_aio_rw(BlockDriverState *bs, static BlockAIOCB *qemu_archipelago_aio_rw(BlockDriverState *bs,
int64_t sector_num, int64_t sector_num,
QEMUIOVector *qiov, QEMUIOVector *qiov,
int nb_sectors, int nb_sectors,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque, void *opaque,
int op) int op)
{ {
ArchipelagoAIOCB *aio_cb; ArchipelagoAIOCB *aio_cb;
BDRVArchipelagoState *s = bs->opaque; BDRVArchipelagoState *s = bs->opaque;
@ -894,7 +894,7 @@ err_exit:
return NULL; return NULL;
} }
static BlockDriverAIOCB *qemu_archipelago_aio_readv(BlockDriverState *bs, static BlockAIOCB *qemu_archipelago_aio_readv(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -902,7 +902,7 @@ static BlockDriverAIOCB *qemu_archipelago_aio_readv(BlockDriverState *bs,
opaque, ARCHIP_OP_READ); opaque, ARCHIP_OP_READ);
} }
static BlockDriverAIOCB *qemu_archipelago_aio_writev(BlockDriverState *bs, static BlockAIOCB *qemu_archipelago_aio_writev(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -1052,7 +1052,7 @@ static QemuOptsList qemu_archipelago_create_opts = {
} }
}; };
static BlockDriverAIOCB *qemu_archipelago_aio_flush(BlockDriverState *bs, static BlockAIOCB *qemu_archipelago_aio_flush(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
return qemu_archipelago_aio_rw(bs, 0, NULL, 0, cb, opaque, return qemu_archipelago_aio_rw(bs, 0, NULL, 0, cb, opaque,

View file

@ -41,7 +41,7 @@ typedef struct BDRVBlkdebugState {
} BDRVBlkdebugState; } BDRVBlkdebugState;
typedef struct BlkdebugAIOCB { typedef struct BlkdebugAIOCB {
BlockDriverAIOCB common; BlockAIOCB common;
QEMUBH *bh; QEMUBH *bh;
int ret; int ret;
} BlkdebugAIOCB; } BlkdebugAIOCB;
@ -463,7 +463,7 @@ static void error_callback_bh(void *opaque)
qemu_aio_unref(acb); qemu_aio_unref(acb);
} }
static BlockDriverAIOCB *inject_error(BlockDriverState *bs, static BlockAIOCB *inject_error(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, void *opaque, BlkdebugRule *rule) BlockDriverCompletionFunc *cb, void *opaque, BlkdebugRule *rule)
{ {
BDRVBlkdebugState *s = bs->opaque; BDRVBlkdebugState *s = bs->opaque;
@ -489,7 +489,7 @@ static BlockDriverAIOCB *inject_error(BlockDriverState *bs,
return &acb->common; return &acb->common;
} }
static BlockDriverAIOCB *blkdebug_aio_readv(BlockDriverState *bs, static BlockAIOCB *blkdebug_aio_readv(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -511,7 +511,7 @@ static BlockDriverAIOCB *blkdebug_aio_readv(BlockDriverState *bs,
return bdrv_aio_readv(bs->file, sector_num, qiov, nb_sectors, cb, opaque); return bdrv_aio_readv(bs->file, sector_num, qiov, nb_sectors, cb, opaque);
} }
static BlockDriverAIOCB *blkdebug_aio_writev(BlockDriverState *bs, static BlockAIOCB *blkdebug_aio_writev(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -533,7 +533,7 @@ static BlockDriverAIOCB *blkdebug_aio_writev(BlockDriverState *bs,
return bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, cb, opaque); return bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, cb, opaque);
} }
static BlockDriverAIOCB *blkdebug_aio_flush(BlockDriverState *bs, static BlockAIOCB *blkdebug_aio_flush(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
BDRVBlkdebugState *s = bs->opaque; BDRVBlkdebugState *s = bs->opaque;

View file

@ -19,7 +19,7 @@ typedef struct {
typedef struct BlkverifyAIOCB BlkverifyAIOCB; typedef struct BlkverifyAIOCB BlkverifyAIOCB;
struct BlkverifyAIOCB { struct BlkverifyAIOCB {
BlockDriverAIOCB common; BlockAIOCB common;
QEMUBH *bh; QEMUBH *bh;
/* Request metadata */ /* Request metadata */
@ -229,7 +229,7 @@ static void blkverify_verify_readv(BlkverifyAIOCB *acb)
} }
} }
static BlockDriverAIOCB *blkverify_aio_readv(BlockDriverState *bs, static BlockAIOCB *blkverify_aio_readv(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -249,7 +249,7 @@ static BlockDriverAIOCB *blkverify_aio_readv(BlockDriverState *bs,
return &acb->common; return &acb->common;
} }
static BlockDriverAIOCB *blkverify_aio_writev(BlockDriverState *bs, static BlockAIOCB *blkverify_aio_writev(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -264,9 +264,9 @@ static BlockDriverAIOCB *blkverify_aio_writev(BlockDriverState *bs,
return &acb->common; return &acb->common;
} }
static BlockDriverAIOCB *blkverify_aio_flush(BlockDriverState *bs, static BlockAIOCB *blkverify_aio_flush(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
BDRVBlkverifyState *s = bs->opaque; BDRVBlkverifyState *s = bs->opaque;

View file

@ -78,7 +78,7 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle,
struct BDRVCURLState; struct BDRVCURLState;
typedef struct CURLAIOCB { typedef struct CURLAIOCB {
BlockDriverAIOCB common; BlockAIOCB common;
QEMUBH *bh; QEMUBH *bh;
QEMUIOVector *qiov; QEMUIOVector *qiov;
@ -680,7 +680,7 @@ static void curl_readv_bh_cb(void *p)
curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running); curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running);
} }
static BlockDriverAIOCB *curl_aio_readv(BlockDriverState *bs, static BlockAIOCB *curl_aio_readv(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {

View file

@ -80,7 +80,7 @@ typedef struct IscsiTask {
} IscsiTask; } IscsiTask;
typedef struct IscsiAIOCB { typedef struct IscsiAIOCB {
BlockDriverAIOCB common; BlockAIOCB common;
QEMUIOVector *qiov; QEMUIOVector *qiov;
QEMUBH *bh; QEMUBH *bh;
IscsiLun *iscsilun; IscsiLun *iscsilun;
@ -227,7 +227,7 @@ iscsi_abort_task_cb(struct iscsi_context *iscsi, int status, void *command_data,
} }
static void static void
iscsi_aio_cancel(BlockDriverAIOCB *blockacb) iscsi_aio_cancel(BlockAIOCB *blockacb)
{ {
IscsiAIOCB *acb = (IscsiAIOCB *)blockacb; IscsiAIOCB *acb = (IscsiAIOCB *)blockacb;
IscsiLun *iscsilun = acb->iscsilun; IscsiLun *iscsilun = acb->iscsilun;
@ -663,7 +663,7 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status,
iscsi_schedule_bh(acb); iscsi_schedule_bh(acb);
} }
static BlockDriverAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs,
unsigned long int req, void *buf, unsigned long int req, void *buf,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {

View file

@ -28,7 +28,7 @@
#define MAX_QUEUED_IO 128 #define MAX_QUEUED_IO 128
struct qemu_laiocb { struct qemu_laiocb {
BlockDriverAIOCB common; BlockAIOCB common;
struct qemu_laio_state *ctx; struct qemu_laio_state *ctx;
struct iocb iocb; struct iocb iocb;
ssize_t ret; ssize_t ret;
@ -146,7 +146,7 @@ static void qemu_laio_completion_cb(EventNotifier *e)
} }
} }
static void laio_cancel(BlockDriverAIOCB *blockacb) static void laio_cancel(BlockAIOCB *blockacb)
{ {
struct qemu_laiocb *laiocb = (struct qemu_laiocb *)blockacb; struct qemu_laiocb *laiocb = (struct qemu_laiocb *)blockacb;
struct io_event event; struct io_event event;
@ -243,7 +243,7 @@ int laio_io_unplug(BlockDriverState *bs, void *aio_ctx, bool unplug)
return ret; return ret;
} }
BlockDriverAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd, BlockAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque, int type) BlockDriverCompletionFunc *cb, void *opaque, int type)
{ {

View file

@ -78,7 +78,7 @@ static coroutine_fn int null_co_flush(BlockDriverState *bs)
} }
typedef struct { typedef struct {
BlockDriverAIOCB common; BlockAIOCB common;
QEMUBH *bh; QEMUBH *bh;
} NullAIOCB; } NullAIOCB;
@ -94,9 +94,9 @@ static void null_bh_cb(void *opaque)
qemu_aio_unref(acb); qemu_aio_unref(acb);
} }
static inline BlockDriverAIOCB *null_aio_common(BlockDriverState *bs, static inline BlockAIOCB *null_aio_common(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
NullAIOCB *acb; NullAIOCB *acb;
@ -106,27 +106,27 @@ static inline BlockDriverAIOCB *null_aio_common(BlockDriverState *bs,
return &acb->common; return &acb->common;
} }
static BlockDriverAIOCB *null_aio_readv(BlockDriverState *bs, static BlockAIOCB *null_aio_readv(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int64_t sector_num, QEMUIOVector *qiov,
int nb_sectors, int nb_sectors,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
return null_aio_common(bs, cb, opaque); return null_aio_common(bs, cb, opaque);
} }
static BlockDriverAIOCB *null_aio_writev(BlockDriverState *bs, static BlockAIOCB *null_aio_writev(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int64_t sector_num, QEMUIOVector *qiov,
int nb_sectors, int nb_sectors,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
return null_aio_common(bs, cb, opaque); return null_aio_common(bs, cb, opaque);
} }
static BlockDriverAIOCB *null_aio_flush(BlockDriverState *bs, static BlockAIOCB *null_aio_flush(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
return null_aio_common(bs, cb, opaque); return null_aio_common(bs, cb, opaque);
} }

View file

@ -1365,11 +1365,11 @@ static void qed_aio_next_io(void *opaque, int ret)
io_fn, acb); io_fn, acb);
} }
static BlockDriverAIOCB *qed_aio_setup(BlockDriverState *bs, static BlockAIOCB *qed_aio_setup(BlockDriverState *bs,
int64_t sector_num, int64_t sector_num,
QEMUIOVector *qiov, int nb_sectors, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque, int flags) void *opaque, int flags)
{ {
QEDAIOCB *acb = qemu_aio_get(&qed_aiocb_info, bs, cb, opaque); QEDAIOCB *acb = qemu_aio_get(&qed_aiocb_info, bs, cb, opaque);
@ -1390,20 +1390,20 @@ static BlockDriverAIOCB *qed_aio_setup(BlockDriverState *bs,
return &acb->common; return &acb->common;
} }
static BlockDriverAIOCB *bdrv_qed_aio_readv(BlockDriverState *bs, static BlockAIOCB *bdrv_qed_aio_readv(BlockDriverState *bs,
int64_t sector_num, int64_t sector_num,
QEMUIOVector *qiov, int nb_sectors, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
return qed_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque, 0); return qed_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque, 0);
} }
static BlockDriverAIOCB *bdrv_qed_aio_writev(BlockDriverState *bs, static BlockAIOCB *bdrv_qed_aio_writev(BlockDriverState *bs,
int64_t sector_num, int64_t sector_num,
QEMUIOVector *qiov, int nb_sectors, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
return qed_aio_setup(bs, sector_num, qiov, nb_sectors, cb, return qed_aio_setup(bs, sector_num, qiov, nb_sectors, cb,
opaque, QED_AIOCB_WRITE); opaque, QED_AIOCB_WRITE);
@ -1431,7 +1431,7 @@ static int coroutine_fn bdrv_qed_co_write_zeroes(BlockDriverState *bs,
int nb_sectors, int nb_sectors,
BdrvRequestFlags flags) BdrvRequestFlags flags)
{ {
BlockDriverAIOCB *blockacb; BlockAIOCB *blockacb;
BDRVQEDState *s = bs->opaque; BDRVQEDState *s = bs->opaque;
QEDWriteZeroesCB cb = { .done = false }; QEDWriteZeroesCB cb = { .done = false };
QEMUIOVector qiov; QEMUIOVector qiov;

View file

@ -128,7 +128,7 @@ enum {
}; };
typedef struct QEDAIOCB { typedef struct QEDAIOCB {
BlockDriverAIOCB common; BlockAIOCB common;
QEMUBH *bh; QEMUBH *bh;
int bh_ret; /* final return status for completion bh */ int bh_ret; /* final return status for completion bh */
QSIMPLEQ_ENTRY(QEDAIOCB) next; /* next request */ QSIMPLEQ_ENTRY(QEDAIOCB) next; /* next request */

View file

@ -92,7 +92,7 @@ typedef struct QuorumAIOCB QuorumAIOCB;
* $children_count QuorumChildRequest. * $children_count QuorumChildRequest.
*/ */
typedef struct QuorumChildRequest { typedef struct QuorumChildRequest {
BlockDriverAIOCB *aiocb; BlockAIOCB *aiocb;
QEMUIOVector qiov; QEMUIOVector qiov;
uint8_t *buf; uint8_t *buf;
int ret; int ret;
@ -105,7 +105,7 @@ typedef struct QuorumChildRequest {
* used to do operations on each children and track overall progress. * used to do operations on each children and track overall progress.
*/ */
struct QuorumAIOCB { struct QuorumAIOCB {
BlockDriverAIOCB common; BlockAIOCB common;
/* Request metadata */ /* Request metadata */
uint64_t sector_num; uint64_t sector_num;
@ -130,7 +130,7 @@ struct QuorumAIOCB {
static bool quorum_vote(QuorumAIOCB *acb); static bool quorum_vote(QuorumAIOCB *acb);
static void quorum_aio_cancel(BlockDriverAIOCB *blockacb) static void quorum_aio_cancel(BlockAIOCB *blockacb)
{ {
QuorumAIOCB *acb = container_of(blockacb, QuorumAIOCB, common); QuorumAIOCB *acb = container_of(blockacb, QuorumAIOCB, common);
BDRVQuorumState *s = acb->common.bs->opaque; BDRVQuorumState *s = acb->common.bs->opaque;
@ -264,7 +264,7 @@ static void quorum_rewrite_aio_cb(void *opaque, int ret)
quorum_aio_finalize(acb); quorum_aio_finalize(acb);
} }
static BlockDriverAIOCB *read_fifo_child(QuorumAIOCB *acb); static BlockAIOCB *read_fifo_child(QuorumAIOCB *acb);
static void quorum_copy_qiov(QEMUIOVector *dest, QEMUIOVector *source) static void quorum_copy_qiov(QEMUIOVector *dest, QEMUIOVector *source)
{ {
@ -640,7 +640,7 @@ free_exit:
return rewrite; return rewrite;
} }
static BlockDriverAIOCB *read_quorum_children(QuorumAIOCB *acb) static BlockAIOCB *read_quorum_children(QuorumAIOCB *acb)
{ {
BDRVQuorumState *s = acb->common.bs->opaque; BDRVQuorumState *s = acb->common.bs->opaque;
int i; int i;
@ -659,7 +659,7 @@ static BlockDriverAIOCB *read_quorum_children(QuorumAIOCB *acb)
return &acb->common; return &acb->common;
} }
static BlockDriverAIOCB *read_fifo_child(QuorumAIOCB *acb) static BlockAIOCB *read_fifo_child(QuorumAIOCB *acb)
{ {
BDRVQuorumState *s = acb->common.bs->opaque; BDRVQuorumState *s = acb->common.bs->opaque;
@ -675,12 +675,12 @@ static BlockDriverAIOCB *read_fifo_child(QuorumAIOCB *acb)
return &acb->common; return &acb->common;
} }
static BlockDriverAIOCB *quorum_aio_readv(BlockDriverState *bs, static BlockAIOCB *quorum_aio_readv(BlockDriverState *bs,
int64_t sector_num, int64_t sector_num,
QEMUIOVector *qiov, QEMUIOVector *qiov,
int nb_sectors, int nb_sectors,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
BDRVQuorumState *s = bs->opaque; BDRVQuorumState *s = bs->opaque;
QuorumAIOCB *acb = quorum_aio_get(s, bs, qiov, sector_num, QuorumAIOCB *acb = quorum_aio_get(s, bs, qiov, sector_num,
@ -696,12 +696,12 @@ static BlockDriverAIOCB *quorum_aio_readv(BlockDriverState *bs,
return read_fifo_child(acb); return read_fifo_child(acb);
} }
static BlockDriverAIOCB *quorum_aio_writev(BlockDriverState *bs, static BlockAIOCB *quorum_aio_writev(BlockDriverState *bs,
int64_t sector_num, int64_t sector_num,
QEMUIOVector *qiov, QEMUIOVector *qiov,
int nb_sectors, int nb_sectors,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
BDRVQuorumState *s = bs->opaque; BDRVQuorumState *s = bs->opaque;
QuorumAIOCB *acb = quorum_aio_get(s, bs, qiov, sector_num, nb_sectors, QuorumAIOCB *acb = quorum_aio_get(s, bs, qiov, sector_num, nb_sectors,

View file

@ -35,7 +35,7 @@
#ifdef CONFIG_LINUX_AIO #ifdef CONFIG_LINUX_AIO
void *laio_init(void); void *laio_init(void);
void laio_cleanup(void *s); void laio_cleanup(void *s);
BlockDriverAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd, BlockAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque, int type); BlockDriverCompletionFunc *cb, void *opaque, int type);
void laio_detach_aio_context(void *s, AioContext *old_context); void laio_detach_aio_context(void *s, AioContext *old_context);
@ -49,7 +49,7 @@ typedef struct QEMUWin32AIOState QEMUWin32AIOState;
QEMUWin32AIOState *win32_aio_init(void); QEMUWin32AIOState *win32_aio_init(void);
void win32_aio_cleanup(QEMUWin32AIOState *aio); void win32_aio_cleanup(QEMUWin32AIOState *aio);
int win32_aio_attach(QEMUWin32AIOState *aio, HANDLE hfile); int win32_aio_attach(QEMUWin32AIOState *aio, HANDLE hfile);
BlockDriverAIOCB *win32_aio_submit(BlockDriverState *bs, BlockAIOCB *win32_aio_submit(BlockDriverState *bs,
QEMUWin32AIOState *aio, HANDLE hfile, QEMUWin32AIOState *aio, HANDLE hfile,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque, int type); BlockDriverCompletionFunc *cb, void *opaque, int type);

View file

@ -1041,7 +1041,7 @@ static int paio_submit_co(BlockDriverState *bs, int fd,
return thread_pool_submit_co(pool, aio_worker, acb); return thread_pool_submit_co(pool, aio_worker, acb);
} }
static BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd, static BlockAIOCB *paio_submit(BlockDriverState *bs, int fd,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque, int type) BlockDriverCompletionFunc *cb, void *opaque, int type)
{ {
@ -1066,7 +1066,7 @@ static BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd,
return thread_pool_submit_aio(pool, aio_worker, acb, cb, opaque); return thread_pool_submit_aio(pool, aio_worker, acb, cb, opaque);
} }
static BlockDriverAIOCB *raw_aio_submit(BlockDriverState *bs, static BlockAIOCB *raw_aio_submit(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque, int type) BlockDriverCompletionFunc *cb, void *opaque, int type)
{ {
@ -1125,7 +1125,7 @@ static void raw_aio_flush_io_queue(BlockDriverState *bs)
#endif #endif
} }
static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs, static BlockAIOCB *raw_aio_readv(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -1133,7 +1133,7 @@ static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs,
cb, opaque, QEMU_AIO_READ); cb, opaque, QEMU_AIO_READ);
} }
static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs, static BlockAIOCB *raw_aio_writev(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -1141,7 +1141,7 @@ static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs,
cb, opaque, QEMU_AIO_WRITE); cb, opaque, QEMU_AIO_WRITE);
} }
static BlockDriverAIOCB *raw_aio_flush(BlockDriverState *bs, static BlockAIOCB *raw_aio_flush(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
BDRVRawState *s = bs->opaque; BDRVRawState *s = bs->opaque;
@ -1595,7 +1595,7 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs,
return ret; return ret;
} }
static coroutine_fn BlockDriverAIOCB *raw_aio_discard(BlockDriverState *bs, static coroutine_fn BlockAIOCB *raw_aio_discard(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, int64_t sector_num, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -1935,7 +1935,7 @@ static int hdev_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
return ioctl(s->fd, req, buf); return ioctl(s->fd, req, buf);
} }
static BlockDriverAIOCB *hdev_aio_ioctl(BlockDriverState *bs, static BlockAIOCB *hdev_aio_ioctl(BlockDriverState *bs,
unsigned long int req, void *buf, unsigned long int req, void *buf,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -1976,7 +1976,7 @@ static int fd_open(BlockDriverState *bs)
#endif /* !linux && !FreeBSD */ #endif /* !linux && !FreeBSD */
static coroutine_fn BlockDriverAIOCB *hdev_aio_discard(BlockDriverState *bs, static coroutine_fn BlockAIOCB *hdev_aio_discard(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, int64_t sector_num, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {

View file

@ -138,7 +138,7 @@ static int aio_worker(void *arg)
return ret; return ret;
} }
static BlockDriverAIOCB *paio_submit(BlockDriverState *bs, HANDLE hfile, static BlockAIOCB *paio_submit(BlockDriverState *bs, HANDLE hfile,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque, int type) BlockDriverCompletionFunc *cb, void *opaque, int type)
{ {
@ -369,7 +369,7 @@ fail:
return ret; return ret;
} }
static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs, static BlockAIOCB *raw_aio_readv(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -383,7 +383,7 @@ static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs,
} }
} }
static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs, static BlockAIOCB *raw_aio_writev(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
@ -397,7 +397,7 @@ static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs,
} }
} }
static BlockDriverAIOCB *raw_aio_flush(BlockDriverState *bs, static BlockAIOCB *raw_aio_flush(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {
BDRVRawState *s = bs->opaque; BDRVRawState *s = bs->opaque;

View file

@ -129,10 +129,10 @@ static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
return bdrv_ioctl(bs->file, req, buf); return bdrv_ioctl(bs->file, req, buf);
} }
static BlockDriverAIOCB *raw_aio_ioctl(BlockDriverState *bs, static BlockAIOCB *raw_aio_ioctl(BlockDriverState *bs,
unsigned long int req, void *buf, unsigned long int req, void *buf,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
return bdrv_aio_ioctl(bs->file, req, buf, cb, opaque); return bdrv_aio_ioctl(bs->file, req, buf, cb, opaque);
} }

View file

@ -68,7 +68,7 @@ typedef enum {
} RBDAIOCmd; } RBDAIOCmd;
typedef struct RBDAIOCB { typedef struct RBDAIOCB {
BlockDriverAIOCB common; BlockAIOCB common;
QEMUBH *bh; QEMUBH *bh;
int64_t ret; int64_t ret;
QEMUIOVector *qiov; QEMUIOVector *qiov;
@ -589,13 +589,13 @@ static int rbd_aio_flush_wrapper(rbd_image_t image,
#endif #endif
} }
static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
int64_t sector_num, int64_t sector_num,
QEMUIOVector *qiov, QEMUIOVector *qiov,
int nb_sectors, int nb_sectors,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque, void *opaque,
RBDAIOCmd cmd) RBDAIOCmd cmd)
{ {
RBDAIOCB *acb; RBDAIOCB *acb;
RADOSCB *rcb = NULL; RADOSCB *rcb = NULL;
@ -675,32 +675,32 @@ failed:
return NULL; return NULL;
} }
static BlockDriverAIOCB *qemu_rbd_aio_readv(BlockDriverState *bs, static BlockAIOCB *qemu_rbd_aio_readv(BlockDriverState *bs,
int64_t sector_num, int64_t sector_num,
QEMUIOVector *qiov, QEMUIOVector *qiov,
int nb_sectors, int nb_sectors,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
return rbd_start_aio(bs, sector_num, qiov, nb_sectors, cb, opaque, return rbd_start_aio(bs, sector_num, qiov, nb_sectors, cb, opaque,
RBD_AIO_READ); RBD_AIO_READ);
} }
static BlockDriverAIOCB *qemu_rbd_aio_writev(BlockDriverState *bs, static BlockAIOCB *qemu_rbd_aio_writev(BlockDriverState *bs,
int64_t sector_num, int64_t sector_num,
QEMUIOVector *qiov, QEMUIOVector *qiov,
int nb_sectors, int nb_sectors,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
return rbd_start_aio(bs, sector_num, qiov, nb_sectors, cb, opaque, return rbd_start_aio(bs, sector_num, qiov, nb_sectors, cb, opaque,
RBD_AIO_WRITE); RBD_AIO_WRITE);
} }
#ifdef LIBRBD_SUPPORTS_AIO_FLUSH #ifdef LIBRBD_SUPPORTS_AIO_FLUSH
static BlockDriverAIOCB *qemu_rbd_aio_flush(BlockDriverState *bs, static BlockAIOCB *qemu_rbd_aio_flush(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
return rbd_start_aio(bs, 0, NULL, 0, cb, opaque, RBD_AIO_FLUSH); return rbd_start_aio(bs, 0, NULL, 0, cb, opaque, RBD_AIO_FLUSH);
} }
@ -876,11 +876,11 @@ static int qemu_rbd_snap_list(BlockDriverState *bs,
} }
#ifdef LIBRBD_SUPPORTS_DISCARD #ifdef LIBRBD_SUPPORTS_DISCARD
static BlockDriverAIOCB* qemu_rbd_aio_discard(BlockDriverState *bs, static BlockAIOCB* qemu_rbd_aio_discard(BlockDriverState *bs,
int64_t sector_num, int64_t sector_num,
int nb_sectors, int nb_sectors,
BlockDriverCompletionFunc *cb, BlockDriverCompletionFunc *cb,
void *opaque) void *opaque)
{ {
return rbd_start_aio(bs, sector_num, NULL, nb_sectors, cb, opaque, return rbd_start_aio(bs, sector_num, NULL, nb_sectors, cb, opaque,
RBD_AIO_DISCARD); RBD_AIO_DISCARD);

View file

@ -301,7 +301,7 @@ enum AIOCBState {
}; };
struct SheepdogAIOCB { struct SheepdogAIOCB {
BlockDriverAIOCB common; BlockAIOCB common;
QEMUIOVector *qiov; QEMUIOVector *qiov;
@ -473,7 +473,7 @@ static bool sd_acb_cancelable(const SheepdogAIOCB *acb)
return true; return true;
} }
static void sd_aio_cancel(BlockDriverAIOCB *blockacb) static void sd_aio_cancel(BlockAIOCB *blockacb)
{ {
SheepdogAIOCB *acb = (SheepdogAIOCB *)blockacb; SheepdogAIOCB *acb = (SheepdogAIOCB *)blockacb;
BDRVSheepdogState *s = acb->common.bs->opaque; BDRVSheepdogState *s = acb->common.bs->opaque;

View file

@ -44,7 +44,7 @@ struct QEMUWin32AIOState {
}; };
typedef struct QEMUWin32AIOCB { typedef struct QEMUWin32AIOCB {
BlockDriverAIOCB common; BlockAIOCB common;
struct QEMUWin32AIOState *ctx; struct QEMUWin32AIOState *ctx;
int nbytes; int nbytes;
OVERLAPPED ov; OVERLAPPED ov;
@ -110,7 +110,7 @@ static const AIOCBInfo win32_aiocb_info = {
.aiocb_size = sizeof(QEMUWin32AIOCB), .aiocb_size = sizeof(QEMUWin32AIOCB),
}; };
BlockDriverAIOCB *win32_aio_submit(BlockDriverState *bs, BlockAIOCB *win32_aio_submit(BlockDriverState *bs,
QEMUWin32AIOState *aio, HANDLE hfile, QEMUWin32AIOState *aio, HANDLE hfile,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque, int type) BlockDriverCompletionFunc *cb, void *opaque, int type)

View file

@ -67,9 +67,9 @@ void qemu_sglist_destroy(QEMUSGList *qsg)
} }
typedef struct { typedef struct {
BlockDriverAIOCB common; BlockAIOCB common;
BlockDriverState *bs; BlockDriverState *bs;
BlockDriverAIOCB *acb; BlockAIOCB *acb;
QEMUSGList *sg; QEMUSGList *sg;
uint64_t sector_num; uint64_t sector_num;
DMADirection dir; DMADirection dir;
@ -173,7 +173,7 @@ static void dma_bdrv_cb(void *opaque, int ret)
assert(dbs->acb); assert(dbs->acb);
} }
static void dma_aio_cancel(BlockDriverAIOCB *acb) static void dma_aio_cancel(BlockAIOCB *acb)
{ {
DMAAIOCB *dbs = container_of(acb, DMAAIOCB, common); DMAAIOCB *dbs = container_of(acb, DMAAIOCB, common);
@ -190,7 +190,7 @@ static const AIOCBInfo dma_aiocb_info = {
.cancel_async = dma_aio_cancel, .cancel_async = dma_aio_cancel,
}; };
BlockDriverAIOCB *dma_bdrv_io( BlockAIOCB *dma_bdrv_io(
BlockDriverState *bs, QEMUSGList *sg, uint64_t sector_num, BlockDriverState *bs, QEMUSGList *sg, uint64_t sector_num,
DMAIOFunc *io_func, BlockDriverCompletionFunc *cb, DMAIOFunc *io_func, BlockDriverCompletionFunc *cb,
void *opaque, DMADirection dir) void *opaque, DMADirection dir)
@ -214,17 +214,17 @@ BlockDriverAIOCB *dma_bdrv_io(
} }
BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs, BlockAIOCB *dma_bdrv_read(BlockDriverState *bs,
QEMUSGList *sg, uint64_t sector, QEMUSGList *sg, uint64_t sector,
void (*cb)(void *opaque, int ret), void *opaque) void (*cb)(void *opaque, int ret), void *opaque)
{ {
return dma_bdrv_io(bs, sg, sector, bdrv_aio_readv, cb, opaque, return dma_bdrv_io(bs, sg, sector, bdrv_aio_readv, cb, opaque,
DMA_DIRECTION_FROM_DEVICE); DMA_DIRECTION_FROM_DEVICE);
} }
BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs, BlockAIOCB *dma_bdrv_write(BlockDriverState *bs,
QEMUSGList *sg, uint64_t sector, QEMUSGList *sg, uint64_t sector,
void (*cb)(void *opaque, int ret), void *opaque) void (*cb)(void *opaque, int ret), void *opaque)
{ {
return dma_bdrv_io(bs, sg, sector, bdrv_aio_writev, cb, opaque, return dma_bdrv_io(bs, sg, sector, bdrv_aio_writev, cb, opaque,
DMA_DIRECTION_TO_DEVICE); DMA_DIRECTION_TO_DEVICE);

View file

@ -70,10 +70,10 @@ Rules support the following attributes:
once - (optional, default "off") only execute this action on the first once - (optional, default "off") only execute this action on the first
matching request matching request
immediately - (optional, default "off") return a NULL BlockDriverAIOCB immediately - (optional, default "off") return a NULL BlockAIOCB
pointer and fail without an errno instead. This exercises the pointer and fail without an errno instead. This
code path where BlockDriverAIOCB fails and the caller's exercises the code path where BlockAIOCB fails and the
BlockDriverCompletionFunc is not invoked. caller's BlockDriverCompletionFunc is not invoked.
Events Events
------ ------

View file

@ -636,7 +636,7 @@ typedef struct NvmeAsyncEvent {
typedef struct NvmeRequest { typedef struct NvmeRequest {
struct NvmeSQueue *sq; struct NvmeSQueue *sq;
BlockDriverAIOCB *aiocb; BlockAIOCB *aiocb;
uint16_t status; uint16_t status;
NvmeCqe cqe; NvmeCqe cqe;
BlockAcctCookie acct; BlockAcctCookie acct;

View file

@ -241,7 +241,7 @@ typedef struct AHCIDevice AHCIDevice;
typedef struct NCQTransferState { typedef struct NCQTransferState {
AHCIDevice *drive; AHCIDevice *drive;
BlockDriverAIOCB *aiocb; BlockAIOCB *aiocb;
QEMUSGList sglist; QEMUSGList sglist;
BlockAcctCookie acct; BlockAcctCookie acct;
uint16_t sector_count; uint16_t sector_count;

View file

@ -360,15 +360,15 @@ static void ide_set_signature(IDEState *s)
} }
typedef struct TrimAIOCB { typedef struct TrimAIOCB {
BlockDriverAIOCB common; BlockAIOCB common;
QEMUBH *bh; QEMUBH *bh;
int ret; int ret;
QEMUIOVector *qiov; QEMUIOVector *qiov;
BlockDriverAIOCB *aiocb; BlockAIOCB *aiocb;
int i, j; int i, j;
} TrimAIOCB; } TrimAIOCB;
static void trim_aio_cancel(BlockDriverAIOCB *acb) static void trim_aio_cancel(BlockAIOCB *acb)
{ {
TrimAIOCB *iocb = container_of(acb, TrimAIOCB, common); TrimAIOCB *iocb = container_of(acb, TrimAIOCB, common);
@ -438,7 +438,7 @@ static void ide_issue_trim_cb(void *opaque, int ret)
} }
} }
BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs, BlockAIOCB *ide_issue_trim(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {

View file

@ -389,7 +389,7 @@ struct IDEState {
int cd_sector_size; int cd_sector_size;
int atapi_dma; /* true if dma is requested for the packet cmd */ int atapi_dma; /* true if dma is requested for the packet cmd */
BlockAcctCookie acct; BlockAcctCookie acct;
BlockDriverAIOCB *pio_aiocb; BlockAIOCB *pio_aiocb;
struct iovec iov; struct iovec iov;
QEMUIOVector qiov; QEMUIOVector qiov;
/* ATA DMA state */ /* ATA DMA state */
@ -442,7 +442,7 @@ struct IDEDMA {
const struct IDEDMAOps *ops; const struct IDEDMAOps *ops;
struct iovec iov; struct iovec iov;
QEMUIOVector qiov; QEMUIOVector qiov;
BlockDriverAIOCB *aiocb; BlockAIOCB *aiocb;
}; };
struct IDEBus { struct IDEBus {
@ -555,7 +555,7 @@ void ide_transfer_start(IDEState *s, uint8_t *buf, int size,
EndTransferFunc *end_transfer_func); EndTransferFunc *end_transfer_func);
void ide_transfer_stop(IDEState *s); void ide_transfer_stop(IDEState *s);
void ide_set_inactive(IDEState *s, bool more); void ide_set_inactive(IDEState *s, bool more);
BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs, BlockAIOCB *ide_issue_trim(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);

View file

@ -131,7 +131,7 @@ typedef struct MACIOIDEState {
MemoryRegion mem; MemoryRegion mem;
IDEBus bus; IDEBus bus;
BlockDriverAIOCB *aiocb; BlockAIOCB *aiocb;
IDEDMA dma; IDEDMA dma;
void *dbdma; void *dbdma;
bool dma_active; bool dma_active;

View file

@ -22,16 +22,16 @@
#include "qemu/rfifolock.h" #include "qemu/rfifolock.h"
#include "qemu/timer.h" #include "qemu/timer.h"
typedef struct BlockDriverAIOCB BlockDriverAIOCB; typedef struct BlockAIOCB BlockAIOCB;
typedef void BlockDriverCompletionFunc(void *opaque, int ret); typedef void BlockDriverCompletionFunc(void *opaque, int ret);
typedef struct AIOCBInfo { typedef struct AIOCBInfo {
void (*cancel_async)(BlockDriverAIOCB *acb); void (*cancel_async)(BlockAIOCB *acb);
AioContext *(*get_aio_context)(BlockDriverAIOCB *acb); AioContext *(*get_aio_context)(BlockAIOCB *acb);
size_t aiocb_size; size_t aiocb_size;
} AIOCBInfo; } AIOCBInfo;
struct BlockDriverAIOCB { struct BlockAIOCB {
const AIOCBInfo *aiocb_info; const AIOCBInfo *aiocb_info;
BlockDriverState *bs; BlockDriverState *bs;
BlockDriverCompletionFunc *cb; BlockDriverCompletionFunc *cb;

View file

@ -248,9 +248,9 @@ int bdrv_write(BlockDriverState *bs, int64_t sector_num,
const uint8_t *buf, int nb_sectors); const uint8_t *buf, int nb_sectors);
int bdrv_write_zeroes(BlockDriverState *bs, int64_t sector_num, int bdrv_write_zeroes(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, BdrvRequestFlags flags); int nb_sectors, BdrvRequestFlags flags);
BlockDriverAIOCB *bdrv_aio_write_zeroes(BlockDriverState *bs, int64_t sector_num, BlockAIOCB *bdrv_aio_write_zeroes(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, BdrvRequestFlags flags, int nb_sectors, BdrvRequestFlags flags,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
int bdrv_make_zero(BlockDriverState *bs, BdrvRequestFlags flags); int bdrv_make_zero(BlockDriverState *bs, BdrvRequestFlags flags);
int bdrv_pread(BlockDriverState *bs, int64_t offset, int bdrv_pread(BlockDriverState *bs, int64_t offset,
void *buf, int count); void *buf, int count);
@ -326,19 +326,19 @@ BlockDriverState *check_to_replace_node(const char *node_name, Error **errp);
/* async block I/O */ /* async block I/O */
typedef void BlockDriverDirtyHandler(BlockDriverState *bs, int64_t sector, typedef void BlockDriverDirtyHandler(BlockDriverState *bs, int64_t sector,
int sector_num); int sector_num);
BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num, BlockAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num,
QEMUIOVector *iov, int nb_sectors, QEMUIOVector *iov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num, BlockAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num,
QEMUIOVector *iov, int nb_sectors, QEMUIOVector *iov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs, BlockAIOCB *bdrv_aio_flush(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
BlockDriverAIOCB *bdrv_aio_discard(BlockDriverState *bs, BlockAIOCB *bdrv_aio_discard(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, int64_t sector_num, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
void bdrv_aio_cancel(BlockDriverAIOCB *acb); void bdrv_aio_cancel(BlockAIOCB *acb);
void bdrv_aio_cancel_async(BlockDriverAIOCB *acb); void bdrv_aio_cancel_async(BlockAIOCB *acb);
typedef struct BlockRequest { typedef struct BlockRequest {
/* Fields to be filled by multiwrite caller */ /* Fields to be filled by multiwrite caller */
@ -358,7 +358,7 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs,
/* sg packet commands */ /* sg packet commands */
int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf); int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf);
BlockDriverAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs,
unsigned long int req, void *buf, unsigned long int req, void *buf,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);

View file

@ -128,15 +128,15 @@ struct BlockDriver {
void (*bdrv_refresh_filename)(BlockDriverState *bs); void (*bdrv_refresh_filename)(BlockDriverState *bs);
/* aio */ /* aio */
BlockDriverAIOCB *(*bdrv_aio_readv)(BlockDriverState *bs, BlockAIOCB *(*bdrv_aio_readv)(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
BlockDriverAIOCB *(*bdrv_aio_writev)(BlockDriverState *bs, BlockAIOCB *(*bdrv_aio_writev)(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
BlockDriverAIOCB *(*bdrv_aio_flush)(BlockDriverState *bs, BlockAIOCB *(*bdrv_aio_flush)(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
BlockDriverAIOCB *(*bdrv_aio_discard)(BlockDriverState *bs, BlockAIOCB *(*bdrv_aio_discard)(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, int64_t sector_num, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
@ -218,7 +218,7 @@ struct BlockDriver {
/* to control generic scsi devices */ /* to control generic scsi devices */
int (*bdrv_ioctl)(BlockDriverState *bs, unsigned long int req, void *buf); int (*bdrv_ioctl)(BlockDriverState *bs, unsigned long int req, void *buf);
BlockDriverAIOCB *(*bdrv_aio_ioctl)(BlockDriverState *bs, BlockAIOCB *(*bdrv_aio_ioctl)(BlockDriverState *bs,
unsigned long int req, void *buf, unsigned long int req, void *buf,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);

View file

@ -27,7 +27,7 @@ typedef struct ThreadPool ThreadPool;
ThreadPool *thread_pool_new(struct AioContext *ctx); ThreadPool *thread_pool_new(struct AioContext *ctx);
void thread_pool_free(ThreadPool *pool); void thread_pool_free(ThreadPool *pool);
BlockDriverAIOCB *thread_pool_submit_aio(ThreadPool *pool, BlockAIOCB *thread_pool_submit_aio(ThreadPool *pool,
ThreadPoolFunc *func, void *arg, ThreadPoolFunc *func, void *arg,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
int coroutine_fn thread_pool_submit_co(ThreadPool *pool, int coroutine_fn thread_pool_submit_co(ThreadPool *pool,

View file

@ -68,7 +68,7 @@ struct SCSIRequest {
bool io_canceled; bool io_canceled;
bool retry; bool retry;
bool dma_started; bool dma_started;
BlockDriverAIOCB *aiocb; BlockAIOCB *aiocb;
QEMUSGList *sg; QEMUSGList *sg;
QTAILQ_ENTRY(SCSIRequest) next; QTAILQ_ENTRY(SCSIRequest) next;
}; };

View file

@ -197,20 +197,20 @@ void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len);
void qemu_sglist_destroy(QEMUSGList *qsg); void qemu_sglist_destroy(QEMUSGList *qsg);
#endif #endif
typedef BlockDriverAIOCB *DMAIOFunc(BlockDriverState *bs, int64_t sector_num, typedef BlockAIOCB *DMAIOFunc(BlockDriverState *bs, int64_t sector_num,
QEMUIOVector *iov, int nb_sectors, QEMUIOVector *iov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
BlockDriverAIOCB *dma_bdrv_io(BlockDriverState *bs, BlockAIOCB *dma_bdrv_io(BlockDriverState *bs,
QEMUSGList *sg, uint64_t sector_num, QEMUSGList *sg, uint64_t sector_num,
DMAIOFunc *io_func, BlockDriverCompletionFunc *cb, DMAIOFunc *io_func, BlockDriverCompletionFunc *cb,
void *opaque, DMADirection dir); void *opaque, DMADirection dir);
BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs, BlockAIOCB *dma_bdrv_read(BlockDriverState *bs,
QEMUSGList *sg, uint64_t sector, QEMUSGList *sg, uint64_t sector,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs, BlockAIOCB *dma_bdrv_write(BlockDriverState *bs,
QEMUSGList *sg, uint64_t sector, QEMUSGList *sg, uint64_t sector,
BlockDriverCompletionFunc *cb, void *opaque); BlockDriverCompletionFunc *cb, void *opaque);
uint64_t dma_buf_read(uint8_t *ptr, int32_t len, QEMUSGList *sg); uint64_t dma_buf_read(uint8_t *ptr, int32_t len, QEMUSGList *sg);
uint64_t dma_buf_write(uint8_t *ptr, int32_t len, QEMUSGList *sg); uint64_t dma_buf_write(uint8_t *ptr, int32_t len, QEMUSGList *sg);

View file

@ -11,7 +11,7 @@ static ThreadPool *pool;
static int active; static int active;
typedef struct { typedef struct {
BlockDriverAIOCB *aiocb; BlockAIOCB *aiocb;
int n; int n;
int ret; int ret;
} WorkerTestData; } WorkerTestData;

View file

@ -34,7 +34,7 @@ enum ThreadState {
}; };
struct ThreadPoolElement { struct ThreadPoolElement {
BlockDriverAIOCB common; BlockAIOCB common;
ThreadPool *pool; ThreadPool *pool;
ThreadPoolFunc *func; ThreadPoolFunc *func;
void *arg; void *arg;
@ -195,7 +195,7 @@ restart:
} }
} }
static void thread_pool_cancel(BlockDriverAIOCB *acb) static void thread_pool_cancel(BlockAIOCB *acb)
{ {
ThreadPoolElement *elem = (ThreadPoolElement *)acb; ThreadPoolElement *elem = (ThreadPoolElement *)acb;
ThreadPool *pool = elem->pool; ThreadPool *pool = elem->pool;
@ -220,7 +220,7 @@ static void thread_pool_cancel(BlockDriverAIOCB *acb)
qemu_mutex_unlock(&pool->lock); qemu_mutex_unlock(&pool->lock);
} }
static AioContext *thread_pool_get_aio_context(BlockDriverAIOCB *acb) static AioContext *thread_pool_get_aio_context(BlockAIOCB *acb)
{ {
ThreadPoolElement *elem = (ThreadPoolElement *)acb; ThreadPoolElement *elem = (ThreadPoolElement *)acb;
ThreadPool *pool = elem->pool; ThreadPool *pool = elem->pool;
@ -233,7 +233,7 @@ static const AIOCBInfo thread_pool_aiocb_info = {
.get_aio_context = thread_pool_get_aio_context, .get_aio_context = thread_pool_get_aio_context,
}; };
BlockDriverAIOCB *thread_pool_submit_aio(ThreadPool *pool, BlockAIOCB *thread_pool_submit_aio(ThreadPool *pool,
ThreadPoolFunc *func, void *arg, ThreadPoolFunc *func, void *arg,
BlockDriverCompletionFunc *cb, void *opaque) BlockDriverCompletionFunc *cb, void *opaque)
{ {