[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v2] qcow2: do not allocate extra memory
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [PATCH v2] qcow2: do not allocate extra memory |
Date: |
Thu, 14 Jul 2016 12:32:03 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 07/14/2016 10:59 AM, Vladimir Sementsov-Ogievskiy wrote:
> There are no needs to allocate more than one cluster, as we set
> avail_out for deflate to one cluster.
>
> Zlib docs (http://www.zlib.net/manual.html) says:
> "deflate compresses as much data as possible, and stops when the input
> buffer becomes empty or the output buffer becomes full."
>
> So, deflate will not write more than avail_out to output buffer. If
> there is no enough space in output buffer for compressed data (it may be
s/no/not/
> larger than input data) deflate just returns Z_OK. (if all data is
> compressed and written to output buffer deflate returns Z_STREAM_END).
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
> ---
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature