Received: from eggs.gnu.org ([2001:4830:134:3::10]:46645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bv3xU-0002Ij-VY for qemu-devel@nongnu.org; Fri, 14 Oct 2016 10:59:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bv3xO-0004u5-VK for qemu-devel@nongnu.org; Fri, 14 Oct 2016 10:59:39 -0400 References: <1476380062-18001-1-git-send-email-pbonzini@redhat.com> <1476380062-18001-13-git-send-email-pbonzini@redhat.com> <20161014145025.GA17349@lemon> From: Paolo Bonzini Message-ID: <8db262a6-3211-a77c-cb86-d7ff6021b96c@redhat.com> Date: Fri, 14 Oct 2016 16:59:28 +0200 MIME-Version: 1.0 In-Reply-To: <20161014145025.GA17349@lemon> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 12/18] iothread: detach all block devices before stopping them List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, kwolf@redhat.com, stefanha@redhat.com On 14/10/2016 16:50, Fam Zheng wrote: >> > + BdrvNextIterator it; >> > + >> > + for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) { >> > + AioContext *ctx = bdrv_get_aio_context(bs); > I have a strong feeling that we should 'continue' if ctx == > qemu_get_aio_context() - otherwise a lot of unnecessary (and somehow > complicated) code will always run, even if user has no iothread. > > Fam > >> > + aio_context_acquire(ctx); >> > + bdrv_set_aio_context(bs, qemu_get_aio_context()); >> > + aio_context_release(ctx); >> > + } Sounds good. Paolo