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 > CC: Kevin Wolf > CC: Max Reitz > CC: Stefan Hajnoczi > CC: Fam Zheng > --- > 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