qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC 1/1] qcow2: add ZSTD compression feature


From: Eric Blake
Subject: Re: [Qemu-devel] [RFC 1/1] qcow2: add ZSTD compression feature
Date: Thu, 23 Mar 2017 09:17:42 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 03/23/2017 08:28 AM, Denis V. Lunev wrote:
> ZSDT compression algorithm consumes 3-5 times less CPU power with a

s/ZSDT/ZSTD/

> comparable comression ratio with zlib. It would be wise to use it for

s/comression/compression/

> data compression f.e. for backups.
> 
> The patch adds incompatible ZSDT feature into QCOW2 header that indicates
> that compressed clusters must be decoded using ZSTD.
> 
> Signed-off-by: Denis V. Lunev <address@hidden>
> CC: Kevin Wolf <address@hidden>
> CC: Max Reitz <address@hidden>
> CC: Stefan Hajnoczi <address@hidden>
> CC: Fam Zheng <address@hidden>
> ---
> Actually this is very straightforward. May be we should implement 2 stage
> scheme, i.e. add bit that indicates presence of the "compression
> extension", which will actually define the compression algorithm. Though
> at my opinion we will not have too many compression algorithms and proposed
> one tier scheme is good enough.

I wouldn't bet on NEVER changing compression algorithms again, and while
I suspect that we won't necessarily run out of bits, it's safer to not
require burning another bit every time we change our minds.  Having a
two-level scheme means we only have to burn 1 bit for the use of a
compression extension header, where we can then flip algorithms in the
extension header without having to burn a top-level incompatible feature
bit every time.

> 
>  docs/specs/qcow2.txt | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/specs/qcow2.txt b/docs/specs/qcow2.txt
> index 80cdfd0..eb5c41b 100644
> --- a/docs/specs/qcow2.txt
> +++ b/docs/specs/qcow2.txt
> @@ -85,7 +85,10 @@ in the description of a field.
>                                  be written to (unless for regaining
>                                  consistency).
>  
> -                    Bits 2-63:  Reserved (set to 0)
> +                    Bits 2:     ZSDT compression bit. ZSDT algorithm is used

s/ZSDT/ZSTD/

Another reason I think you should add a compression extension header:
compression algorithms are probably best treated as mutually-exclusive
(the entire image should be compressed with exactly one compressor).
Even if we only ever add one more type (say 'xz') in addition to the
existing gzip and your proposed zstd, then we do NOT want someone
specifying both xz and zstd at the same time.  Having a single
incompatible feature bit that states that a compression header must be
present and honored to understand the image, where the compression
header then chooses exactly one compression algorithm, seems safer than
having two separate incompatible feature bits for two opposing algorithms.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]