From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgwBi-0000s4-Ke for qemu-devel@nongnu.org; Tue, 29 Sep 2015 10:47:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgwBf-0002NN-9n for qemu-devel@nongnu.org; Tue, 29 Sep 2015 10:47:26 -0400 Sender: Paolo Bonzini References: <56097990.7040007@redhat.com> <20150929083914.GC3930@noname.str.redhat.com> From: Paolo Bonzini Message-ID: <560AA478.8080303@redhat.com> Date: Tue, 29 Sep 2015 16:47:20 +0200 MIME-Version: 1.0 In-Reply-To: <20150929083914.GC3930@noname.str.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit 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 , Max Reitz Cc: stefanha@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 29/09/2015 10:39, Kevin Wolf wrote: > bdrv_has_zero_init() takes care of that, in theory. The "problem" > here is that the target is opened with BDRV_O_NO_BACKING, so the > block layer doesn't consider this an image with a backing file. I think bdrv_has_zero_init() is working right. If you read the qcow2 file as it was opened (i.e. with BDRV_O_NO_BACKING), unallocated areas will indeed read as zeroes. Of course if the file is opened with BDRV_O_NO_BACKING but does have a backing file, you ought not to read unallocated areas at all. So it's not the answer (of bdrv_has_zero_init) that is wrong, but the question that was not well-specified. > Is there anything better than bs->backing_hd that we could check? It's simply sync == 'full', I think. Then the problematic case never even reaches bdrv_has_zero_init. Paolo -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWCqRqAAoJEL/70l94x66DgcUH/jN8VFkGpZxXS5b+TnU8BeGV Xmr3AjqICYS4K1mKcuu20GKZO5QSTh4Z7p/Igo2KmiGqven2kT/NIvjPRlSv4tqZ Vov6AaamO6OIme+nA0hYbc3ANUY+b/7CqL8tDb3rKzah0FeFMSi1x7Who7aOCTQs IjsJ37/ay+mGmPR9akDAfqjJjGPBJFL9dxz/0pgdPDUyj7IwvyolgGZ49rGNzoHE /86Dy23ET16HQHDOz3afsrLHf9gxGZFCMsLJostqH0cuMs2sk1qnY9i9xEXYUM00 XNoaVafwCeH1ypXHNcP+GWtbbHBaMJJtmoRFB72VDRPq39XvpzWhifbKK3+c2Qw= =/2aT -----END PGP SIGNATURE-----