From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpaEF-0005u8-F2 for qemu-devel@nongnu.org; Thu, 29 Sep 2016 08:14:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpaEE-0007V1-EF for qemu-devel@nongnu.org; Thu, 29 Sep 2016 08:14:19 -0400 Sender: Paolo Bonzini References: <1475046261-15679-1-git-send-email-famz@redhat.com> <20160929092917.GC5742@noname.redhat.com> <20160929095506.GD1118@lemon> <20160929103957.GG5742@noname.redhat.com> From: Paolo Bonzini Message-ID: Date: Thu, 29 Sep 2016 14:14:09 +0200 MIME-Version: 1.0 In-Reply-To: <20160929103957.GG5742@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 , Fam Zheng Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Max Reitz 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. Paolo