From patchwork Fri Dec 6 16:36:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 298188 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 3032A2C009F for ; Sat, 7 Dec 2013 05:41:07 +1100 (EST) Received: from localhost ([::1]:60096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Voybc-0006cI-Nd for incoming@patchwork.ozlabs.org; Fri, 06 Dec 2013 11:50:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoyQP-0000ij-EY for qemu-devel@nongnu.org; Fri, 06 Dec 2013 11:38:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VoyQK-0003xr-CZ for qemu-devel@nongnu.org; Fri, 06 Dec 2013 11:38:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoyQK-0003xj-43 for qemu-devel@nongnu.org; Fri, 06 Dec 2013 11:38:40 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rB6GcdrG014650 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 6 Dec 2013 11:38:39 -0500 Received: from localhost (ovpn-112-22.ams2.redhat.com [10.36.112.22]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rB6GcbJE018901; Fri, 6 Dec 2013 11:38:38 -0500 From: Stefan Hajnoczi To: Date: Fri, 6 Dec 2013 17:36:45 +0100 Message-Id: <1386347807-27359-47-git-send-email-stefanha@redhat.com> In-Reply-To: <1386347807-27359-1-git-send-email-stefanha@redhat.com> References: <1386347807-27359-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Stefan Hajnoczi , Anthony Liguori Subject: [Qemu-devel] [PULL 46/48] block: clean up bdrv_drain_all() throttling comments 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 Since cc0681c45430a1f1a4c2d06e9499b7775afc9a18 ("block: Enable the new throttling code in the block layer.") bdrv_drain_all() no longer spins. The code used to look as follows: do { busy = qemu_aio_wait(); /* FIXME: We do not have timer support here, so this is effectively * a busy wait. */ QTAILQ_FOREACH(bs, &bdrv_states, list) { while (qemu_co_enter_next(&bs->throttled_reqs)) { busy = true; } } } while (busy); Note that throttle requests are kicked but I/O throttling limits are still in effect. The loop spins until the vm_clock time allows the request to make progress and complete. The new throttling code introduced bdrv_start_throttled_reqs(). This function not only kicks throttled requests but also temporarily disables throttling so requests can run. The outdated FIXME comment can be removed. Also drop the busy = true assignment since we overwrite it immediately afterwards. Reviewed-by: Alex Bligh Signed-off-by: Stefan Hajnoczi --- block.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/block.c b/block.c index 1c83ef1..13f001a 100644 --- a/block.c +++ b/block.c @@ -1557,13 +1557,8 @@ void bdrv_drain_all(void) BlockDriverState *bs; while (busy) { - /* FIXME: We do not have timer support here, so this is effectively - * a busy wait. - */ QTAILQ_FOREACH(bs, &bdrv_states, list) { - if (bdrv_start_throttled_reqs(bs)) { - busy = true; - } + bdrv_start_throttled_reqs(bs); } busy = bdrv_requests_pending_all();