From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlKP9-0005LP-NS for qemu-devel@nongnu.org; Tue, 26 Nov 2013 10:18:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlKP4-00063r-NM for qemu-devel@nongnu.org; Tue, 26 Nov 2013 10:18:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39426) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlKP4-00063n-EE for qemu-devel@nongnu.org; Tue, 26 Nov 2013 10:18:18 -0500 From: Stefan Hajnoczi Date: Tue, 26 Nov 2013 16:18:00 +0100 Message-Id: <1385479081-17887-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1385479081-17887-1-git-send-email-stefanha@redhat.com> References: <1385479081-17887-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH v2 1/2] block: clean up bdrv_drain_all() throttling comments List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , pingfank@linux.vnet.ibm.com, alex@alex.org.uk, jan.kiszka@siemens.com, Stefan Hajnoczi , pbonzini@redhat.com 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 382ea71..13ad3fd 100644 --- a/block.c +++ b/block.c @@ -1559,13 +1559,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(); -- 1.8.4.2