Patchwork [07/13] Remove active field in qemu_aiocb structure.

login
register
mail settings
Submitter Arun Bharadwaj
Date Jan. 4, 2011, 5:27 a.m.
Message ID <20110104052744.15887.2452.stgit@localhost6.localdomain6>
Download mbox | patch
Permalink /patch/77386/
State New
Headers show

Comments

Arun Bharadwaj - Jan. 4, 2011, 5:27 a.m.
The active field in the qemu_aiocb structure is now useless.
Remove it.

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

Patch

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);