From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpanA-00046C-Mt for qemu-devel@nongnu.org; Thu, 29 Sep 2016 08:50:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpan8-0007Uv-LY for qemu-devel@nongnu.org; Thu, 29 Sep 2016 08:50:23 -0400 References: <1475046261-15679-1-git-send-email-famz@redhat.com> <20160929092917.GC5742@noname.redhat.com> <20160929095506.GD1118@lemon> <20160929103957.GG5742@noname.redhat.com> <20160929124815.GL5742@noname.redhat.com> From: Paolo Bonzini Message-ID: Date: Thu, 29 Sep 2016 14:50:10 +0200 MIME-Version: 1.0 In-Reply-To: <20160929124815.GL5742@noname.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qcow2: Support BDRV_REQ_MAY_UNMAP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Fam Zheng , qemu-devel@nongnu.org, qemu-block@nongnu.org, Max Reitz On 29/09/2016 14:48, Kevin Wolf wrote: > Am 29.09.2016 um 14:14 hat Paolo Bonzini geschrieben: >> On 29/09/2016 12:39, Kevin Wolf wrote: >>>>> Because there is another check of pass-discard-request value in >>>>> update_refcount: >>>>> >>>>> if (refcount == 0 && s->discard_passthrough[type]) { >>>>> update_refcount_discard(bs, cluster_offset, s->cluster_size); >>>>> } >>> What I mean is that in the second case, you're still uselessly >>> deallocating the cluster on the qcow2 level while you can't reclaim it >>> on the filesystem level. So it would be better to leave it allocated in >>> qcow2, too, so that you don't get an expensive reallocation the next >>> time you write to it. >> >> But if you do a qemu-img convert, the deallocated cluster wouldn't be in >> the destination. > > Right. I still think that there has to be an option to keep the image > fully allocated. Perhaps what we really need to check is BDRV_O_UNMAP. Duh, of course it is. Paolo