/* Fast-path if already in coroutine context */
bdrv_rw_co_entry(&rwco);
} else {
+ AioContext *aio_context = bdrv_get_aio_context(bs);
+
co = qemu_coroutine_create(bdrv_rw_co_entry);
qemu_coroutine_enter(co, &rwco);
while (rwco.ret == NOT_DONE) {
- qemu_aio_wait();
+ aio_poll(aio_context, true);
}
}
return rwco.ret;
/* Fast-path if already in coroutine context */
bdrv_get_block_status_co_entry(&data);
} else {
+ AioContext *aio_context = bdrv_get_aio_context(bs);
+
co = qemu_coroutine_create(bdrv_get_block_status_co_entry);
qemu_coroutine_enter(co, &data);
while (!data.done) {
- qemu_aio_wait();
+ aio_poll(aio_context, true);
}
}
return data.ret;
acb->is_write = is_write;
acb->qiov = qiov;
acb->bounce = qemu_blockalign(bs, qiov->size);
- acb->bh = qemu_bh_new(bdrv_aio_bh_cb, acb);
+ acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_aio_bh_cb, acb);
if (is_write) {
qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size);
static void bdrv_aio_co_cancel_em(BlockDriverAIOCB *blockacb)
{
+ AioContext *aio_context = bdrv_get_aio_context(blockacb->bs);
BlockDriverAIOCBCoroutine *acb =
container_of(blockacb, BlockDriverAIOCBCoroutine, common);
bool done = false;
acb->done = &done;
while (!done) {
- qemu_aio_wait();
+ aio_poll(aio_context, true);
}
}
acb->req.nb_sectors, acb->req.qiov, acb->req.flags);
}
- acb->bh = qemu_bh_new(bdrv_co_em_bh, acb);
+ acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_co_em_bh, acb);
qemu_bh_schedule(acb->bh);
}
BlockDriverState *bs = acb->common.bs;
acb->req.error = bdrv_co_flush(bs);
- acb->bh = qemu_bh_new(bdrv_co_em_bh, acb);
+ acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_co_em_bh, acb);
qemu_bh_schedule(acb->bh);
}
BlockDriverState *bs = acb->common.bs;
acb->req.error = bdrv_co_discard(bs, acb->req.sector, acb->req.nb_sectors);
- acb->bh = qemu_bh_new(bdrv_co_em_bh, acb);
+ acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_co_em_bh, acb);
qemu_bh_schedule(acb->bh);
}
/* Fast-path if already in coroutine context */
bdrv_flush_co_entry(&rwco);
} else {
+ AioContext *aio_context = bdrv_get_aio_context(bs);
+
co = qemu_coroutine_create(bdrv_flush_co_entry);
qemu_coroutine_enter(co, &rwco);
while (rwco.ret == NOT_DONE) {
- qemu_aio_wait();
+ aio_poll(aio_context, true);
}
}
/* Fast-path if already in coroutine context */
bdrv_discard_co_entry(&rwco);
} else {
+ AioContext *aio_context = bdrv_get_aio_context(bs);
+
co = qemu_coroutine_create(bdrv_discard_co_entry);
qemu_coroutine_enter(co, &rwco);
while (rwco.ret == NOT_DONE) {
- qemu_aio_wait();
+ aio_poll(aio_context, true);
}
}