From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xwqia-0008G6-Vz for qemu-devel@nongnu.org; Fri, 05 Dec 2014 06:06:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwqiU-0003nd-Pv for qemu-devel@nongnu.org; Fri, 05 Dec 2014 06:06:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwqiU-0003nY-I7 for qemu-devel@nongnu.org; Fri, 05 Dec 2014 06:06:30 -0500 Message-ID: <548191AF.3030905@redhat.com> Date: Fri, 05 Dec 2014 12:06:23 +0100 From: Max Reitz MIME-Version: 1.0 References: <1417775209-11812-1-git-send-email-kwolf@redhat.com> In-Reply-To: <1417775209-11812-1-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vhdx: Return true for bdrv_has_zero_init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-devel@nongnu.org Cc: amulya.lokesha@emc.com, jcody@redhat.com, stefanha@redhat.com On 2014-12-05 at 11:26, Kevin Wolf wrote: > Like for most other image formats, vhdx images read as all zero in qemu > after their creation (we're taking advantage from the fact that qemu has > just created the image, because PAYLOAD_BLOCK_NOT_PRESENT actually means > undefined rather than zeroed according to the spec). I think whether qemu created the image doesn't matter. If it's undefined, it's completely valid for qemu to interpret it as zeroed. So, as we discussed, the problem comes in when another program opens the image and actually interprets the data as something else than zero, which will be an issue if we used convert which then will have converted zeros from the input to basically random data (for qcow2 it will be zero again, but for other programs it might not be). We could make block_state_zero=on non-optional, but that would mean we always would have to write the full BAT. Not so nice either. So what could probably solve the problem is a BDS-specific has_zero_init, which would be equal to the block_state_zero value here. But I'm not sure whether we want that either. Max > This fixes that 'qemu-img convert' to vhdx fully populates the image. > > Signed-off-by: Kevin Wolf > --- > block/vhdx.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/block/vhdx.c b/block/vhdx.c > index 12bfe75..8a54da0 100644 > --- a/block/vhdx.c > +++ b/block/vhdx.c > @@ -1951,6 +1951,7 @@ static BlockDriver bdrv_vhdx = { > .bdrv_co_readv = vhdx_co_readv, > .bdrv_co_writev = vhdx_co_writev, > .bdrv_create = vhdx_create, > + .bdrv_has_zero_init = bdrv_has_zero_init_1, > .bdrv_get_info = vhdx_get_info, > .bdrv_check = vhdx_check,