From: Kevin Wolf <kwolf@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: vsementsov@virtuozzo.com, den@virtuozzo.com,
qemu-block@nongnu.org, qemu-devel@nongnu.org, armbru@redhat.com,
mreitz@redhat.com, Denis Plotnikov <dplotnikov@virtuozzo.com>
Subject: Re: [Qemu-devel] [PATCH v1 3/3] qcow2: add zstd cluster compression
Date: Wed, 3 Jul 2019 18:07:03 +0200 [thread overview]
Message-ID: <20190703160703.GB7764@linux.fritz.box> (raw)
In-Reply-To: <e61d7afc-09ce-d52d-3987-df1d5ba6977f@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2032 bytes --]
Am 03.07.2019 um 16:36 hat Eric Blake geschrieben:
> On 7/3/19 6:00 AM, Denis Plotnikov wrote:
> > zstd significantly reduces cluster compression time.
> > It provides better compression performance maintaining
> > the same level of compression ratio in comparison with
> > zlib, which, by the moment, has been the only compression
> > method available.
> >
>
> > ---
> > block/qcow2.c | 96 ++++++++++++++++++++++++++++++++++++++++++++
> > configure | 32 +++++++++++++++
> > qapi/block-core.json | 3 +-
> > 3 files changed, 130 insertions(+), 1 deletion(-)
>
> Where is the change to docs/interop/qcow2.txt to describe this new
> compression format?
>
> >
> > diff --git a/block/qcow2.c b/block/qcow2.c
> > index 37a563a671..caa04b0beb 100644
> > --- a/block/qcow2.c
> > +++ b/block/qcow2.c
> > @@ -27,6 +27,11 @@
> > #define ZLIB_CONST
> > #include <zlib.h>
> >
>
> > +static ssize_t qcow2_zstd_compress(void *dest, size_t dest_size,
> > + const void *src, size_t src_size)
> > +{
> > + ssize_t ret;
> > + uint32_t *c_size = dest;
> > + /* steal some bytes to store compressed chunk size */
> > + char *d_buf = ((char *) dest) + sizeof(*c_size);
> > +
>
> Do you always want exactly 4 bytes for the compressed size? Or is it
> worth some sort of variable-length encoding, since we're already dealing
> with non-cacheline-aligned data? You can represent all sizes up to 4M
> using a maximum of 3 bytes (set the high bit if the integer continues,
> then sizes 0-127 take 1 byte [7 bits], 128-32767 take 2 bytes [15 bits],
> and 32768-4194303 take 3 bytes [22 bits]).
I don't think the additional complexity is worth it. The combination of
endianness conversions (which are missing here, this is a bug!) and
variable lengths is almost guaranteed to not only give us headaches, but
also to result in corner case bugs.
Also, are we sure that we will always keep 2M as the maximum cluster
size?
Kevin
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
prev parent reply other threads:[~2019-07-03 16:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-03 11:00 [Qemu-devel] [PATCH v1 0/3] add zstd cluster compression Denis Plotnikov
2019-07-03 11:00 ` [Qemu-devel] [PATCH v1 1/3] qcow2: introduce compression type feature Denis Plotnikov
2019-07-03 14:14 ` Eric Blake
2019-07-03 15:01 ` Denis Plotnikov
2019-07-03 15:13 ` Eric Blake
2019-07-03 15:37 ` Denis Plotnikov
2019-07-03 15:46 ` Kevin Wolf
2019-07-03 15:54 ` Denis Plotnikov
2019-07-09 11:27 ` Markus Armbruster
2019-07-03 11:00 ` [Qemu-devel] [PATCH v1 2/3] qcow2: rework the cluster compression routine Denis Plotnikov
2019-07-03 11:00 ` [Qemu-devel] [PATCH v1 3/3] qcow2: add zstd cluster compression Denis Plotnikov
2019-07-03 14:36 ` Eric Blake
2019-07-03 15:06 ` Denis Plotnikov
2019-07-03 16:07 ` Kevin Wolf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190703160703.GB7764@linux.fritz.box \
--to=kwolf@redhat.com \
--cc=armbru@redhat.com \
--cc=den@virtuozzo.com \
--cc=dplotnikov@virtuozzo.com \
--cc=eblake@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).