[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 6/8] posix-aio-compat: Honour AsyncContext
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 6/8] posix-aio-compat: Honour AsyncContext |
Date: |
Thu, 22 Oct 2009 17:54:40 +0200 |
Don't call callbacks that don't belong to the active AsyncContext.
Signed-off-by: Kevin Wolf <address@hidden>
---
posix-aio-compat.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/posix-aio-compat.c b/posix-aio-compat.c
index 4901539..ec58288 100644
--- a/posix-aio-compat.c
+++ b/posix-aio-compat.c
@@ -48,6 +48,8 @@ struct qemu_paiocb {
ssize_t ret;
int active;
struct qemu_paiocb *next;
+
+ int async_context_id;
};
typedef struct PosixAioState {
@@ -419,6 +421,7 @@ static int posix_aio_process_queue(void *opaque)
struct qemu_paiocb *acb, **pacb;
int ret;
int result = 0;
+ int async_context_id = get_async_context_id();
for(;;) {
pacb = &s->first_aio;
@@ -426,6 +429,13 @@ static int posix_aio_process_queue(void *opaque)
acb = *pacb;
if (!acb)
return result;
+
+ /* we're only interested in requests in the right context */
+ if (acb->async_context_id != async_context_id) {
+ pacb = &acb->next;
+ continue;
+ }
+
ret = qemu_paio_error(acb);
if (ret == ECANCELED) {
/* remove the request */
@@ -558,6 +568,8 @@ BlockDriverAIOCB *paio_submit(BlockDriverState *bs, void
*aio_ctx, int fd,
acb->aio_type = type;
acb->aio_fildes = fd;
acb->ev_signo = SIGUSR2;
+ acb->async_context_id = get_async_context_id();
+
if (qiov) {
acb->aio_iov = qiov->iov;
acb->aio_niov = qiov->niov;
--
1.6.2.5
- [Qemu-devel] [PATCH 0/8] Fix bdrv_read/write emulation, Kevin Wolf, 2009/10/22
- [Qemu-devel] [PATCH 1/8] posix-aio-compat: Split out posix_aio_process_queue, Kevin Wolf, 2009/10/22
- [Qemu-devel] [PATCH 2/8] Add qemu_aio_process_queue(), Kevin Wolf, 2009/10/22
- [Qemu-devel] [PATCH 3/8] Split out bottom halves, Kevin Wolf, 2009/10/22
- [Qemu-devel] [PATCH 4/8] Introduce contexts for asynchronous callbacks, Kevin Wolf, 2009/10/22
- [Qemu-devel] [PATCH 6/8] posix-aio-compat: Honour AsyncContext,
Kevin Wolf <=
- [Qemu-devel] [PATCH 7/8] linux-aio: Honour AsyncContext, Kevin Wolf, 2009/10/22
- [Qemu-devel] [PATCH 5/8] block: Use new AsyncContext for bdrv_read/write emulation, Kevin Wolf, 2009/10/22
- [Qemu-devel] [PATCH 8/8] Revert "qcow2: Bring synchronous read/write back to life", Kevin Wolf, 2009/10/22