[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-block] [PATCH v2] qcow2: allocate cluster_cache/c
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [Qemu-block] [PATCH v2] qcow2: allocate cluster_cache/cluster_data on demand |
Date: |
Wed, 30 Aug 2017 18:02:16 +0100 |
User-agent: |
Mutt/1.8.3 (2017-05-23) |
On Mon, Aug 21, 2017 at 02:55:30PM +0100, Stefan Hajnoczi wrote:
> Most qcow2 files are uncompressed so it is wasteful to allocate (32 + 1)
> * cluster_size + 512 bytes upfront. Allocate s->cluster_cache and
> s->cluster_data when the first read operation is performance on a
> compressed cluster.
>
> The buffers are freed in .bdrv_close(). .bdrv_open() no longer has any
> code paths that can allocate these buffers, so remove the free functions
> in the error code path.
>
> This patch can result in significant memory savings when many qcow2
> disks are attached or backing file chains are long:
>
> Before 12.81% (1,023,193,088B)
> After 5.36% (393,893,888B)
>
> Reported-by: Alexey Kardashevskiy <address@hidden>
> Tested-by: Alexey Kardashevskiy <address@hidden>
> Cc: Kevin Wolf <address@hidden>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> v2:
> * Changed EIO to ENOMEM [Eric]
> * Added Alexey's Tested-by
> ---
> block/qcow2-cluster.c | 17 +++++++++++++++++
> block/qcow2.c | 12 ------------
> 2 files changed, 17 insertions(+), 12 deletions(-)
Thanks, applied to my block-next tree:
https://github.com/stefanha/qemu/commits/block-next
Stefan