From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnrbN-0007RR-9e for qemu-devel@nongnu.org; Tue, 03 Dec 2013 10:09:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnrbH-0006sT-An for qemu-devel@nongnu.org; Tue, 03 Dec 2013 10:09:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnrbH-0006rK-3p for qemu-devel@nongnu.org; Tue, 03 Dec 2013 10:09:23 -0500 Date: Tue, 3 Dec 2013 16:09:15 +0100 From: Kevin Wolf Message-ID: <20131203150915.GF9956@dhcp-200-207.str.redhat.com> References: <1385124001-3576-1-git-send-email-pbonzini@redhat.com> <1385124001-3576-9-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1385124001-3576-9-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 08/19] block drivers: add discard/write_zeroes properties to bdrv_get_info implementation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: ronniesahlberg@gmail.com, pl@kamp.de, qemu-devel@nongnu.org, stefanha@redhat.com Am 22.11.2013 um 13:39 hat Paolo Bonzini geschrieben: > Signed-off-by: Paolo Bonzini > --- > block/qcow2.c | 2 ++ > block/qed.c | 2 ++ > block/vdi.c | 1 + > block/vhdx.c | 3 +++ > block/vpc.c | 1 + > 5 files changed, 9 insertions(+) > > diff --git a/block/qcow2.c b/block/qcow2.c > index 2fe37ed..1542750 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -1892,6 +1892,8 @@ static coroutine_fn int qcow2_co_flush_to_os(BlockDriverState *bs) > static int qcow2_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) > { > BDRVQcowState *s = bs->opaque; > + bdi->unallocated_blocks_are_zero = true; > + bdi->can_write_zeroes_with_unmap = (s->qcow_version >= 3); > bdi->cluster_size = s->cluster_size; > bdi->vm_state_offset = qcow2_vm_state_offset(s); > return 0; We must change qcow2_discard_clusters() to set the zero flag instead of just deallocating the cluster. (We should be doing that anyway, because the backing file reappearing isn't very nice.) Not quite sure what to do with version 2 images, though. For the other formats, I guess this is only correct because they don't implement discard anyway? Kevin