From patchwork Mon Jun 10 12:25:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 250248 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 48C962C008A for ; Mon, 10 Jun 2013 23:07:29 +1000 (EST) Received: from localhost ([::1]:34540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um1DM-0001DW-Pp for incoming@patchwork.ozlabs.org; Mon, 10 Jun 2013 08:28:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um1BA-0006Kb-G1 for qemu-devel@nongnu.org; Mon, 10 Jun 2013 08:26:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Um1B2-000305-20 for qemu-devel@nongnu.org; Mon, 10 Jun 2013 08:26:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20303) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um1B1-0002zw-PA for qemu-devel@nongnu.org; Mon, 10 Jun 2013 08:26:23 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5ACQLea009002 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 10 Jun 2013 08:26:21 -0400 Received: from localhost (ovpn-112-37.ams2.redhat.com [10.36.112.37]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r5ACQKlu024839; Mon, 10 Jun 2013 08:26:21 -0400 From: Stefan Hajnoczi To: Date: Mon, 10 Jun 2013 14:25:58 +0200 Message-Id: <1370867173-25755-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1370867173-25755-1-git-send-email-stefanha@redhat.com> References: <1370867173-25755-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Paolo Bonzini , Anthony Liguori , Ping Fan Liu , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH v3 02/17] dataplane/virtio-blk: check exit conditions before aio_poll() 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 Check exit conditions before entering blocking aio_poll(). This is mainly for consistency since it's unlikely that we are stopping in the first event loop iteration. Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index 0356665..0509d3f 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -379,9 +379,9 @@ static void *data_plane_thread(void *opaque) { VirtIOBlockDataPlane *s = opaque; - do { + while (!s->stopping || s->num_reqs > 0) { aio_poll(s->ctx, true); - } while (!s->stopping || s->num_reqs > 0); + } return NULL; }