From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgqV2-0007Ae-J2 for qemu-devel@nongnu.org; Tue, 29 Sep 2015 04:43:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgqV1-0004ZZ-LJ for qemu-devel@nongnu.org; Tue, 29 Sep 2015 04:43:00 -0400 References: <56094B0F.7030900@redhat.com> <5609A38F.1070405@redhat.com> <20150929081034.GA3930@noname.str.redhat.com> From: Paolo Bonzini Message-ID: <560A4F0A.50005@redhat.com> Date: Tue, 29 Sep 2015 10:42:50 +0200 MIME-Version: 1.0 In-Reply-To: <20150929081034.GA3930@noname.str.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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: Kevin Wolf , Eric Blake Cc: Jeff Cody , stefanha@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org On 29/09/2015 10:10, Kevin Wolf wrote: >> When mode == 'existing' for a shallow mirror (sync != 'full'), >> that is the caller stating that the guest-visible contents of the >> destination match the guest-visible contents of the backing >> image. The only sectors to be copied are those that differ from >> the backing file, and we should not be zeroing unrelated sectors >> because the user has already promised they have the same >> guest-visible content as the backing image would report. > > Where is this promise documented? I wasn't aware of it and can't > seem to find it in the QAPI documentation of drive-mirror. I don't think it is really a promise, but it's the only sensible way to use this combination. Paolo >> When mode == 'existing' for a full mirror (sync == 'full'), that >> is the caller stating that they want every single sector of the >> destination written to hold the current state of the source (of >> course, allowing for optimizations such as skipping the write >> where the contents will read back the same as if the write had >> been performed). >> >> I think Paolo is right: we care about zeroing unallocated sectors >> for sync == 'full', regardless of whether mode == 'existing'. > > I agree. > >> I also think the reason Jeff confused it for mode == 'existing' >> is that the other modes let qemu create the file, but qemu does >> not create block devices (the only way to mirror to a block >> device is via mode == 'existing'), and it is primarily block >> devices where zero init is not guaranteed. > > 'qemu-img create' works on block devices (even though for raw it > doesn't do more than checking if it's large enough; but for qcow2, > it's obvious that it's necessary), so I'm pretty sure that mode != > 'existing' works on them as well. > > Kevin >