qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 07/13] Remove active field in qemu_aiocb structure.


From: Arun R Bharadwaj
Subject: [Qemu-devel] [PATCH 07/13] Remove active field in qemu_aiocb structure.
Date: Tue, 04 Jan 2011 10:57:44 +0530
User-agent: StGit/0.15

The active field in the qemu_aiocb structure is now useless.
Remove it.

Signed-off-by: Arun R Bharadwaj <address@hidden>
---
 posix-aio-compat.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/posix-aio-compat.c b/posix-aio-compat.c
index 8f1a9b6..fd9fcfd 100644
--- a/posix-aio-compat.c
+++ b/posix-aio-compat.c
@@ -69,7 +69,6 @@ struct qemu_paiocb {
 
     int aio_type;
     ssize_t ret;
-    int active;
     struct qemu_paiocb *next;
 
     int async_context_id;
@@ -345,7 +344,6 @@ static void aio_thread(ThreadletWork *work)
 
     pid = getpid();
     aiocb = container_of(work, struct qemu_paiocb, work);
-    aiocb->active = 1;
 
     switch (aiocb->aio_type & QEMU_AIO_TYPE_MASK) {
     case QEMU_AIO_READ:
@@ -452,7 +450,6 @@ static void qemu_paio_submit(struct qemu_paiocb *aiocb)
 {
     qemu_mutex_lock(&aiocb_mutex);
     aiocb->ret = -EINPROGRESS;
-    aiocb->active = 0;
     qemu_mutex_unlock(&aiocb_mutex);
 
     aiocb->work.func = aio_thread;
@@ -596,15 +593,13 @@ static int dequeue_work(ThreadletWork *work)
 static void paio_cancel(BlockDriverAIOCB *blockacb)
 {
     struct qemu_paiocb *acb = (struct qemu_paiocb *)blockacb;
-    if (!acb->active) {
-        if (dequeue_work(&acb->work) != 0) {
-            /* Wait for running work item to complete */
-            qemu_mutex_lock(&aiocb_mutex);
-            while (acb->ret == -EINPROGRESS) {
-                qemu_cond_wait(&aiocb_completion, &aiocb_mutex);
-            }
-            qemu_mutex_unlock(&aiocb_mutex);
+    if (dequeue_work(&acb->work) != 0) {
+        /* Wait for running work item to complete */
+        qemu_mutex_lock(&aiocb_mutex);
+        while (acb->ret == -EINPROGRESS) {
+            qemu_cond_wait(&aiocb_completion, &aiocb_mutex);
         }
+        qemu_mutex_unlock(&aiocb_mutex);
     }
 
     paio_remove(acb);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]