From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxGxg-00031L-J5 for qemu-devel@nongnu.org; Tue, 26 May 2015 11:40:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxGxc-0006K6-Dr for qemu-devel@nongnu.org; Tue, 26 May 2015 11:40:12 -0400 Message-ID: <556493A0.5040004@redhat.com> Date: Tue, 26 May 2015 17:39:12 +0200 From: Max Reitz MIME-Version: 1.0 References: <11e5272e78e9c9485b47c41feedd6a30dbf0cb8e.1431967209.git.berto@igalia.com> In-Reply-To: <11e5272e78e9c9485b47c41feedd6a30dbf0cb8e.1431967209.git.berto@igalia.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] qcow2: mark the memory as no longer needed after qcow2_cache_empty() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , qemu-block@nongnu.org On 18.05.2015 18:48, Alberto Garcia wrote: > After having emptied the cache, the data in the cache tables is no > longer useful, so we can tell the kernel that we are done with it. In > Linux this frees the resources associated with it. > > The effect of this can be seen in the block-commit operation: it moves > data from the top to the base image (and fills both caches), then it > empties the top image. At this point the data in that cache is no > longer needed so it's just wasting memory. > > Signed-off-by: Alberto Garcia > --- > block/qcow2-cache.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) Looks good, but by applying the same logic, you could do the same call in qcow2_cache_create(). So what about it? :-) Also note that bdrv_commit() is used only by the HMP commit operation, not by QMP commit. Max