From patchwork Fri Dec 12 17:10:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 420582 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id BC41E1400E9 for ; Sat, 13 Dec 2014 04:11:47 +1100 (AEDT) Received: from localhost ([::1]:58574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzTkn-0007uk-MD for incoming@patchwork.ozlabs.org; Fri, 12 Dec 2014 12:11:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzTk1-0006Po-Jx for qemu-devel@nongnu.org; Fri, 12 Dec 2014 12:11:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XzTjv-0004Kb-6M for qemu-devel@nongnu.org; Fri, 12 Dec 2014 12:10:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzTju-0004KC-Uu for qemu-devel@nongnu.org; Fri, 12 Dec 2014 12:10:51 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBCHAlRt004338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 12 Dec 2014 12:10:48 -0500 Received: from localhost (ovpn-112-32.ams2.redhat.com [10.36.112.32]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBCHAkeu007114; Fri, 12 Dec 2014 12:10:47 -0500 From: Stefan Hajnoczi To: Date: Fri, 12 Dec 2014 17:10:03 +0000 Message-Id: <1418404205-6213-18-git-send-email-stefanha@redhat.com> In-Reply-To: <1418404205-6213-1-git-send-email-stefanha@redhat.com> References: <1418404205-6213-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Stefan Hajnoczi , Paolo Bonzini Subject: [Qemu-devel] [PULL 17/19] linux-aio: rename LaioQueue idx field to "n" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Paolo Bonzini It does not identify an index in an array anymore. Signed-off-by: Paolo Bonzini Reviewed-by: Kevin Wolf Message-id: 1418305950-30924-4-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi --- block/linux-aio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/block/linux-aio.c b/block/linux-aio.c index b870942..b223d9e 100644 --- a/block/linux-aio.c +++ b/block/linux-aio.c @@ -40,7 +40,7 @@ struct qemu_laiocb { typedef struct { int plugged; - unsigned int idx; + unsigned int n; bool blocked; QSIMPLEQ_HEAD(, qemu_laiocb) pending; } LaioQueue; @@ -180,7 +180,7 @@ static void ioq_init(LaioQueue *io_q) { QSIMPLEQ_INIT(&io_q->pending); io_q->plugged = 0; - io_q->idx = 0; + io_q->n = 0; io_q->blocked = false; } @@ -208,11 +208,11 @@ static int ioq_submit(struct qemu_laio_state *s) } for (i = 0; i < ret; i++) { - s->io_q.idx--; + s->io_q.n--; QSIMPLEQ_REMOVE_HEAD(&s->io_q.pending, next); } } while (ret == len && !QSIMPLEQ_EMPTY(&s->io_q.pending)); - s->io_q.blocked = (s->io_q.idx > 0); + s->io_q.blocked = (s->io_q.n > 0); return ret; } @@ -276,9 +276,9 @@ BlockAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd, io_set_eventfd(&laiocb->iocb, event_notifier_get_fd(&s->e)); QSIMPLEQ_INSERT_TAIL(&s->io_q.pending, laiocb, next); - s->io_q.idx++; + s->io_q.n++; if (!s->io_q.blocked && - (!s->io_q.plugged || s->io_q.idx >= MAX_QUEUED_IO)) { + (!s->io_q.plugged || s->io_q.n >= MAX_QUEUED_IO)) { ioq_submit(s); } return &laiocb->common;