From patchwork Tue Jan 4 05:27:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun Bharadwaj X-Patchwork-Id: 77386 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3809BB710A for ; Tue, 4 Jan 2011 16:47:45 +1100 (EST) Received: from localhost ([127.0.0.1]:48103 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZzkE-0001pG-Av for incoming@patchwork.ozlabs.org; Tue, 04 Jan 2011 00:47:42 -0500 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 Received: from localhost6.localdomain6 (Crystal-Planet.in.ibm.com [9.124.35.19]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p045RiZm009455; Tue, 4 Jan 2011 16:27:44 +1100 To: qemu-devel@nongnu.org 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> User-Agent: StGit/0.15 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH 07/13] Remove active field in qemu_aiocb structure. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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);