From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buzTg-0007As-6v for qemu-devel@nongnu.org; Fri, 14 Oct 2016 06:12:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buzTf-0007oH-6O for qemu-devel@nongnu.org; Fri, 14 Oct 2016 06:12:36 -0400 Date: Fri, 14 Oct 2016 18:12:26 +0800 From: Fam Zheng Message-ID: <20161014101226.GC14830@lemon> References: <1476380062-18001-1-git-send-email-pbonzini@redhat.com> <1476380062-18001-6-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1476380062-18001-6-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH 05/18] block: change drain to look only at one child at a time List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, kwolf@redhat.com, stefanha@redhat.com On Thu, 10/13 19:34, Paolo Bonzini wrote: > bdrv_requests_pending is checking children to also wait until internal > requests (such as metadata writes) have completed. However, checking > children is in general overkill. Children requests can be of two kinds: > > - requests caused by an operation on bs, e.g. a bdrv_aio_write to bs > causing a write to bs->file->bs. In this case, the parent's in_flight > count will always be incremented by at least one for every request in > the child. Isn't it "incremented by at least one" instead of "one for every request in the child? > > - asynchronous metadata writes or flushes. Such writes can be started > even if bs's in_flight count is zero, but not after the .bdrv_drain > callback has been invoked. > > This patch therefore changes bdrv_drain to finish I/O in the parent > (after which the parent's in_flight will be locked to zero), call > bdrv_drain (after which the parent will not generate I/O on the child > anymore), and then wait for internal I/O in the children to complete. > > Signed-off-by: Paolo Bonzini Fam