[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/11] async: Introduce aio_co_enter
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PULL 05/11] async: Introduce aio_co_enter |
Date: |
Tue, 11 Apr 2017 20:26:26 +0800 |
They start the coroutine on the specified context.
Signed-off-by: Fam Zheng <address@hidden>
Acked-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
---
include/block/aio.h | 9 +++++++++
util/async.c | 7 ++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
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
diff --git a/util/async.c b/util/async.c
index 663e297..355af73 100644
--- a/util/async.c
+++ b/util/async.c
@@ -453,6 +453,11 @@ void aio_co_wake(struct Coroutine *co)
smp_read_barrier_depends();
ctx = atomic_read(&co->ctx);
+ aio_co_enter(ctx, co);
+}
+
+void aio_co_enter(AioContext *ctx, struct Coroutine *co)
+{
if (ctx != qemu_get_current_aio_context()) {
aio_co_schedule(ctx, co);
return;
@@ -464,7 +469,7 @@ void aio_co_wake(struct Coroutine *co)
QSIMPLEQ_INSERT_TAIL(&self->co_queue_wakeup, co, co_queue_next);
} else {
aio_context_acquire(ctx);
- qemu_coroutine_enter(co);
+ qemu_aio_coroutine_enter(ctx, co);
aio_context_release(ctx);
}
}
--
2.9.3
- [Qemu-devel] [PULL 00/11] Block patches for 2.9-rc4, Fam Zheng, 2017/04/11
- [Qemu-devel] [PULL 01/11] block: Make bdrv_parent_drained_begin/end public, Fam Zheng, 2017/04/11
- [Qemu-devel] [PULL 02/11] block: Quiesce old aio context during bdrv_set_aio_context, Fam Zheng, 2017/04/11
- [Qemu-devel] [PULL 03/11] tests/block-job-txn: Don't start block job before adding to txn, Fam Zheng, 2017/04/11
- [Qemu-devel] [PULL 04/11] coroutine: Extract qemu_aio_coroutine_enter, Fam Zheng, 2017/04/11
- [Qemu-devel] [PULL 05/11] async: Introduce aio_co_enter,
Fam Zheng <=
- [Qemu-devel] [PULL 06/11] block: Introduce bdrv_coroutine_enter, Fam Zheng, 2017/04/11
- [Qemu-devel] [PULL 07/11] blockjob: Use bdrv_coroutine_enter to start coroutine, Fam Zheng, 2017/04/11
- [Qemu-devel] [PULL 08/11] qemu-io-cmds: Use bdrv_coroutine_enter, Fam Zheng, 2017/04/11
- [Qemu-devel] [PULL 09/11] block: Use bdrv_coroutine_enter to start I/O coroutines, Fam Zheng, 2017/04/11
- [Qemu-devel] [PULL 11/11] sheepdog: Use bdrv_coroutine_enter before BDRV_POLL_WHILE, Fam Zheng, 2017/04/11
- [Qemu-devel] [PULL 10/11] block: Fix bdrv_co_flush early return, Fam Zheng, 2017/04/11
- Re: [Qemu-devel] [PULL 00/11] Block patches for 2.9-rc4, Peter Maydell, 2017/04/11