From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnrnG-0005Zt-F1 for qemu-devel@nongnu.org; Tue, 03 Dec 2013 10:21:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnrnA-0002XY-FC for qemu-devel@nongnu.org; Tue, 03 Dec 2013 10:21:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnrnA-0002XQ-6y for qemu-devel@nongnu.org; Tue, 03 Dec 2013 10:21:40 -0500 Message-ID: <529DF6F8.4010907@redhat.com> Date: Tue, 03 Dec 2013 16:21:28 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1385124001-3576-1-git-send-email-pbonzini@redhat.com> <1385124001-3576-9-git-send-email-pbonzini@redhat.com> <20131203150915.GF9956@dhcp-200-207.str.redhat.com> In-Reply-To: <20131203150915.GF9956@dhcp-200-207.str.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: Kevin Wolf Cc: ronniesahlberg@gmail.com, pl@kamp.de, qemu-devel@nongnu.org, stefanha@redhat.com Il 03/12/2013 16:09, Kevin Wolf ha scritto: >> > 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.) No, that's not needed: * unallocated_blocks_are_zero is only meaningful for bs->backing_hd == NULL (not too intuitive, but I didn't introduce that interface :)). In fact, v2 was checking backing_hd == NULL but I removed it after Peter noticed I was being inconsistent. * can_write_zeroes_with_unmap correctly returns true only if zero clusters are enabled > For the other formats, I guess this is only correct because they don't > implement discard anyway? No, it is correct because that's what their bdrv_co_readv (or similar) will return when a block is not allocated and there is no backing file. Of course, for many formats there will never be a backing file. Paolo