From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhJHE-0003hL-Ix for qemu-devel@nongnu.org; Wed, 30 Sep 2015 11:26:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhJHD-0004N8-J8 for qemu-devel@nongnu.org; Wed, 30 Sep 2015 11:26:40 -0400 Date: Wed, 30 Sep 2015 17:26:28 +0200 From: Kevin Wolf Message-ID: <20150930152628.GC3989@noname.str.redhat.com> References: <56094B0F.7030900@redhat.com> <5609A38F.1070405@redhat.com> <20150929081034.GA3930@noname.str.redhat.com> <560A4F0A.50005@redhat.com> <20150929093531.GD3930@noname.str.redhat.com> <560A6D71.4080007@redhat.com> <20150930144350.GB11943@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150930144350.GB11943@localhost.localdomain> Subject: Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody Cc: stefanha@redhat.com, Paolo Bonzini , qemu-devel@nongnu.org, qemu-block@nongnu.org Am 30.09.2015 um 16:43 hat Jeff Cody geschrieben: > On Tue, Sep 29, 2015 at 12:52:33PM +0200, Paolo Bonzini wrote: > > > > > > On 29/09/2015 11:35, Kevin Wolf wrote: > > > The caller could be copying the backing file in the background and it > > > may not yet be finished. > > > > Yes, and this is permitted (the destination file of mirroring is opened > > with BDRV_O_NO_BACKING). > > > > Some more assumptions arise when block-job-complete is invoked, because > > at this point the content must not change under the guest's feet. > > Because block-job-complete does bdrv_open_backing_file on the > > destination, for sync!='full' it means that either 1) the image has no > > backing file, but it starts with the content of the backing file or 2) > > the image's backing file is complete at the time block-job-complete is > > invoked. > > > > For mode!='existing' it is always case (2), and the backing file is > > complete all the time; for mode=='existing' the backing file could be > > copied in the background, and case (1) could happen as well. An example > > of case (1) is replacing sync=='full' with a "fast copy" of the backing > > file (e.g. via btrfs's COW copies) and sync=='top'. This should be valid. > > One issue is that QEMU will do mode!='existing' && sync!='full' for > drivers that do not support backing files (raw host devices, for > instance). We could refuse to start a mirror in the case of: > > mode != 'existing' && sync != 'full' && !target->drv->supports_backing > > Alternatively, we could do the two-pass zero approach in this patch, > except under the following conditions: > > sync == 'full' || (mode != 'existing' && !target->drv->supports_backing) > > (In the sync == 'full' case, we could also just queue all sectors, as > Kevin suggested) I don't think that mode == 'existing' should play any role in the behaviour of any block job. There's no reason why doing an external 'qemu-img create' should make it do anything different compared to images created using the monitor. Kevin