From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X21MH-0008Au-El for qemu-devel@nongnu.org; Tue, 01 Jul 2014 12:56:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X21M4-0006MH-57 for qemu-devel@nongnu.org; Tue, 01 Jul 2014 12:56:41 -0400 Received: from mail-qc0-x22b.google.com ([2607:f8b0:400d:c01::22b]:41674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X21Lv-0006KM-5s for qemu-devel@nongnu.org; Tue, 01 Jul 2014 12:56:28 -0400 Received: by mail-qc0-f171.google.com with SMTP id w7so8654234qcr.16 for ; Tue, 01 Jul 2014 09:56:18 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <53B2E82D.8020000@redhat.com> Date: Tue, 01 Jul 2014 18:56:13 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1404201119-6646-1-git-send-email-ming.lei@canonical.com> <1404201119-6646-2-git-send-email-ming.lei@canonical.com> <20140701111843.GE4587@noname.str.redhat.com> <20140701152130.GK4587@noname.str.redhat.com> In-Reply-To: <20140701152130.GK4587@noname.str.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/3] block: block: introduce bdrv_io_plug() and bdrv_io_unplug() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , Ming Lei Cc: Peter Maydell , Fam Zheng , qemu-devel@nongnu.org, Stefan Hajnoczi , "Michael S. Tsirkin" Il 01/07/2014 17:21, Kevin Wolf ha scritto: >>>> Does this bs->file forwarding work for more than the raw driver? For >>>> example, if drv is an image format driver that needs to read some >>>> metadata from the image before it can submit the payload, does this >>>> still do what you were intending? >> >> Sorry for not understanding the problem, and you are right, these >> patches can't support other formats, and for solving the dependency, >> changes to image format driver should be needed. > > Then let's drop the bs->file recursion here and add an explicit > .bdrv_io_plug/unplug callback to the raw driver. Actually I thought about this in my review, and there's no reason for this not to work for image formats. While bs->file is plugged, image formats will start executing their bdrv_co_readv/bdrv_co_writev callbacks, and issue reads or writes as necessary. The reads and writes will accumulate in bs->file until it is unplugged, which is exactly the effect we want. The change in bdrv_drain_all is ugly though. I don't have a better idea, but I would like to understand better why it is needed. Ming Lei, did you see a deadlock without it? Paolo