From 14e9559f4624e704a53d0789124b6f9ea9ebb5ca Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Sat, 8 Apr 2017 11:34:45 +0800 Subject: block: Make bdrv_parent_drained_begin/end public Signed-off-by: Fam Zheng Reviewed-by: Stefan Hajnoczi Acked-by: Stefan Hajnoczi Reviewed-by: Kevin Wolf --- include/block/block.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include') diff --git a/include/block/block.h b/include/block/block.h index 3e09222..488a07e 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -573,6 +573,22 @@ void bdrv_io_plug(BlockDriverState *bs); void bdrv_io_unplug(BlockDriverState *bs); /** + * bdrv_parent_drained_begin: + * + * Begin a quiesced section of all users of @bs. This is part of + * bdrv_drained_begin. + */ +void bdrv_parent_drained_begin(BlockDriverState *bs); + +/** + * bdrv_parent_drained_end: + * + * End a quiesced section of all users of @bs. This is part of + * bdrv_drained_end. + */ +void bdrv_parent_drained_end(BlockDriverState *bs); + +/** * bdrv_drained_begin: * * Begin a quiesced section for exclusive access to the BDS, by disabling -- cgit v1.1 From ba9e75ceef93000e624ae55faf2e498f96be2ec7 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Mon, 10 Apr 2017 20:06:12 +0800 Subject: coroutine: Extract qemu_aio_coroutine_enter It's a variant of qemu_coroutine_enter with an explicit AioContext parameter. Signed-off-by: Fam Zheng Acked-by: Stefan Hajnoczi Reviewed-by: Kevin Wolf --- include/qemu/coroutine.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h index e60beaf..a4509bd 100644 --- a/include/qemu/coroutine.h +++ b/include/qemu/coroutine.h @@ -77,6 +77,11 @@ void qemu_coroutine_enter(Coroutine *coroutine); void qemu_coroutine_enter_if_inactive(Coroutine *co); /** + * Transfer control to a coroutine and associate it with ctx + */ +void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine *co); + +/** * Transfer control back to a coroutine's caller * * This function does not return until the coroutine is re-entered using -- cgit v1.1 From 8865852e00557925f60eb6e26d797833422ee86d Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Mon, 10 Apr 2017 20:07:35 +0800 Subject: async: Introduce aio_co_enter They start the coroutine on the specified context. Signed-off-by: Fam Zheng Acked-by: Stefan Hajnoczi Reviewed-by: Kevin Wolf --- include/block/aio.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/block/aio.h b/include/block/aio.h index 677b6ff..406e323 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -511,6 +511,15 @@ void aio_co_schedule(AioContext *ctx, struct Coroutine *co); void aio_co_wake(struct Coroutine *co); /** + * aio_co_enter: + * @ctx: the context to run the coroutine + * @co: the coroutine to run + * + * Enter a coroutine in the specified AioContext. + */ +void aio_co_enter(AioContext *ctx, struct Coroutine *co); + +/** * Return the AioContext whose event loop runs in the current thread. * * If called from an IOThread this will be the IOThread's AioContext. If -- cgit v1.1 From 052a75721fb38b9aa0e71ea6420b462c0e356e74 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Mon, 10 Apr 2017 20:09:25 +0800 Subject: block: Introduce bdrv_coroutine_enter Signed-off-by: Fam Zheng Acked-by: Stefan Hajnoczi Reviewed-by: Kevin Wolf --- include/block/block.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/block/block.h b/include/block/block.h index 488a07e..97d4330 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -558,6 +558,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: * * Changes the #AioContext used for fd handlers, timers, and BHs by this -- cgit v1.1