From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56243 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZzR2-0001Oe-15 for qemu-devel@nongnu.org; Tue, 04 Jan 2011 00:27:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PZzR0-0004bp-OE for qemu-devel@nongnu.org; Tue, 04 Jan 2011 00:27:51 -0500 Received: from e28smtp04.in.ibm.com ([122.248.162.4]:33687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PZzQz-0004b9-09 for qemu-devel@nongnu.org; Tue, 04 Jan 2011 00:27:50 -0500 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by e28smtp04.in.ibm.com (8.14.4/8.13.1) with ESMTP id p045Rj4V011252 for ; Tue, 4 Jan 2011 10:57:45 +0530 Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p045RjMI4481036 for ; Tue, 4 Jan 2011 10:57:45 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p045RjeH009458 for ; Tue, 4 Jan 2011 16:27:45 +1100 From: Arun R Bharadwaj Date: Tue, 04 Jan 2011 10:57:44 +0530 Message-ID: <20110104052744.15887.2452.stgit@localhost6.localdomain6> In-Reply-To: <20110104052627.15887.43436.stgit@localhost6.localdomain6> References: <20110104052627.15887.43436.stgit@localhost6.localdomain6> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 07/13] Remove active field in qemu_aiocb structure. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com The active field in the qemu_aiocb structure is now useless. Remove it. Signed-off-by: Arun R Bharadwaj --- 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);