From 052a75721fb38b9aa0e71ea6420b462c0e356e74 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Mon, 10 Apr 2017 20:09:25 +0800 Subject: [PATCH] block: Introduce bdrv_coroutine_enter Signed-off-by: Fam Zheng Acked-by: Stefan Hajnoczi Reviewed-by: Kevin Wolf --- block.c | 5 +++++ include/block/block.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/block.c b/block.c index a995a8ec00..086a12df97 100644 --- a/block.c +++ b/block.c @@ -4324,6 +4324,11 @@ AioContext *bdrv_get_aio_context(BlockDriverState *bs) return bs->aio_context; } +void bdrv_coroutine_enter(BlockDriverState *bs, Coroutine *co) +{ + aio_co_enter(bdrv_get_aio_context(bs), co); +} + static void bdrv_do_remove_aio_context_notifier(BdrvAioNotifier *ban) { QLIST_REMOVE(ban, list); diff --git a/include/block/block.h b/include/block/block.h index 488a07ed67..97d4330292 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -557,6 +557,11 @@ bool bdrv_debug_is_suspended(BlockDriverState *bs, const char *tag); */ AioContext *bdrv_get_aio_context(BlockDriverState *bs); +/** + * Transfer control to @co in the aio context of @bs + */ +void bdrv_coroutine_enter(BlockDriverState *bs, Coroutine *co); + /** * bdrv_set_aio_context: *