[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 4/7] aio: Introduce aio_context_setup
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL v2 4/7] aio: Introduce aio_context_setup |
Date: |
Mon, 9 Nov 2015 10:08:21 +0000 |
From: Fam Zheng <address@hidden>
This is the place to initialize platform specific bits of AioContext.
Signed-off-by: Fam Zheng <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
aio-posix.c | 4 ++++
aio-win32.c | 4 ++++
async.c | 13 +++++++++++--
include/block/aio.h | 8 ++++++++
4 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/aio-posix.c b/aio-posix.c
index 0467f23..5bff3cd 100644
--- a/aio-posix.c
+++ b/aio-posix.c
@@ -302,3 +302,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
return progress;
}
+
+void aio_context_setup(AioContext *ctx, Error **errp)
+{
+}
diff --git a/aio-win32.c b/aio-win32.c
index 43c4c79..cdc4456 100644
--- a/aio-win32.c
+++ b/aio-win32.c
@@ -369,3 +369,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
aio_context_release(ctx);
return progress;
}
+
+void aio_context_setup(AioContext *ctx, Error **errp)
+{
+}
diff --git a/async.c b/async.c
index 9589e4b..e106072 100644
--- a/async.c
+++ b/async.c
@@ -325,12 +325,18 @@ AioContext *aio_context_new(Error **errp)
{
int ret;
AioContext *ctx;
+ Error *local_err = NULL;
+
ctx = (AioContext *) g_source_new(&aio_source_funcs, sizeof(AioContext));
+ aio_context_setup(ctx, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ goto fail;
+ }
ret = event_notifier_init(&ctx->notifier, false);
if (ret < 0) {
- g_source_destroy(&ctx->source);
error_setg_errno(errp, -ret, "Failed to initialize event notifier");
- return NULL;
+ goto fail;
}
g_source_set_can_recurse(&ctx->source, true);
aio_set_event_notifier(ctx, &ctx->notifier,
@@ -345,6 +351,9 @@ AioContext *aio_context_new(Error **errp)
ctx->notify_dummy_bh = aio_bh_new(ctx, notify_dummy_bh, NULL);
return ctx;
+fail:
+ g_source_destroy(&ctx->source);
+ return NULL;
}
void aio_context_ref(AioContext *ctx)
diff --git a/include/block/aio.h b/include/block/aio.h
index cab7c76..9ffecf7 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -429,4 +429,12 @@ static inline bool aio_node_check(AioContext *ctx, bool
is_external)
return !is_external || !atomic_read(&ctx->external_disable_cnt);
}
+/**
+ * aio_context_setup:
+ * @ctx: the aio context
+ *
+ * Initialize the aio context.
+ */
+void aio_context_setup(AioContext *ctx, Error **errp);
+
#endif
--
2.5.0
- [Qemu-devel] [PULL v2 0/7] Block patches, Stefan Hajnoczi, 2015/11/09
- [Qemu-devel] [PULL v2 1/7] dataplane: simplify indirect descriptor read, Stefan Hajnoczi, 2015/11/09
- [Qemu-devel] [PULL v2 3/7] aio: Introduce aio_external_disabled, Stefan Hajnoczi, 2015/11/09
- [Qemu-devel] [PULL v2 2/7] dataplane: support non-contigious s/g, Stefan Hajnoczi, 2015/11/09
- [Qemu-devel] [PULL v2 4/7] aio: Introduce aio_context_setup,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL v2 5/7] aio: Introduce aio-epoll.c, Stefan Hajnoczi, 2015/11/09
- [Qemu-devel] [PULL v2 7/7] blockdev: acquire AioContext in hmp_commit(), Stefan Hajnoczi, 2015/11/09
- [Qemu-devel] [PULL v2 6/7] monitor: add missed aio_context_acquire into vm_completion call, Stefan Hajnoczi, 2015/11/09
- Re: [Qemu-devel] [PULL v2 0/7] Block patches, Peter Maydell, 2015/11/09