From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsCSQ-0004wr-3t for qemu-devel@nongnu.org; Thu, 27 Jun 2013 09:41:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsCSN-0006zi-74 for qemu-devel@nongnu.org; Thu, 27 Jun 2013 09:41:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48610) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsCSM-0006zR-UD for qemu-devel@nongnu.org; Thu, 27 Jun 2013 09:41:51 -0400 Date: Thu, 27 Jun 2013 15:29:38 +0200 From: Stefan Hajnoczi Message-ID: <20130627132938.GA29628@stefanha-thinkpad.redhat.com> References: <1371210243-6099-1-git-send-email-stefanha@redhat.com> <1371210243-6099-2-git-send-email-stefanha@redhat.com> <51CC3A6F.4090505@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51CC3A6F.4090505@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 01/17] block: stop relying on io_flush() in bdrv_drain_all() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , Anthony Liguori , Ping Fan Liu , qemu-devel@nongnu.org On Thu, Jun 27, 2013 at 03:13:19PM +0200, Paolo Bonzini wrote: > Il 14/06/2013 13:43, Stefan Hajnoczi ha scritto: > > If a block driver has no file descriptors to monitor but there are still > > active requests, it can return 1 from .io_flush(). This is used to spin > > during synchronous I/O. > > > > Stop relying on .io_flush() and instead check > > QLIST_EMPTY(&bs->tracked_requests) to decide whether there are active > > requests. > > > > This is the first step in removing .io_flush() so that event loops no > > longer need to have the concept of synchronous I/O. Eventually we may > > be able to kill synchronous I/O completely by running everything in a > > coroutine, but that is future work. > > > > Note this patch moves bs->throttled_reqs initialization to bdrv_new() so > > that bdrv_requests_pending(bs) can safely access it. In practice bs is > > g_malloc0() so the memory is already zeroed but it's safer to initialize > > the queue properly. > > > > In bdrv_delete() make sure to call bdrv_make_anon() *after* bdrv_close() > > so that the device is still seen by bdrv_drain_all() when iterating > > bdrv_states. > > I wonder if this last change should be separated out and CCed to > qemu-stable. It seems like a bug if you close a device that has pending > throttled operations. Seems like a good idea. I'll send the next version with a separated Cc: qemu-stable@nongnu.org patch. Stefan