From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S77CZ-0002rE-Tf for qemu-devel@nongnu.org; Mon, 12 Mar 2012 11:30:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S77CP-0000PU-Iv for qemu-devel@nongnu.org; Mon, 12 Mar 2012 11:30:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S77CP-0000P3-BS for qemu-devel@nongnu.org; Mon, 12 Mar 2012 11:30:13 -0400 Message-ID: <4F5E167D.4030209@redhat.com> Date: Mon, 12 Mar 2012 16:30:05 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1331564005-31070-1-git-send-email-zwu.kernel@gmail.com> <4F5E10AE.9010409@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 1/2] block: add the support to drain throttled requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhi Yong Wu Cc: kwolf@redhat.com, Zhi Yong Wu , qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com Il 12/03/2012 16:25, Zhi Yong Wu ha scritto: > > > - qemu_aio_flush(); > > > + QTAILQ_FOREACH(bs, &bdrv_states, list) { > > > + do { > > > + qemu_co_queue_restart_all(&bs->throttled_reqs); > > > + qemu_aio_flush(); > > > + } while (!qemu_co_queue_empty(&bs->throttled_reqs)); > > > + } > > > > Even this is not enough. Block device 2 could start a throttled request > > on block device 1. > > I think that this should be allowed here. It does not affect the final > result. All throttled requests for all disks are drained. Unfortunately, that depends on the order of block devices. It needs to be something like this: do { qemu_aio_flush(); busy = false; QTAILQ_FOREACH(bs, &bdrv_states, list) { if (!qemu_co_queue_empty(&bs->throttled_reqs)) { qemu_co_queue_restart_all(&bs->throttled_reqs); busy = true; } } } while (busy); This means that bdrv_drain() cannot be implemented. The device models can "drain themselves", but for example monitor commands must still rely on bdrv_drain_all(). Paolo