From: Kevin Wolf <kwolf@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com,
stefanha@gmail.com, pl@kamp.de, den@openvz.org
Subject: Re: [Qemu-devel] [PATCH 2/3] qcow2: refactor data compression
Date: Thu, 14 Jun 2018 15:06:13 +0200 [thread overview]
Message-ID: <20180614130613.GE8564@localhost.localdomain> (raw)
In-Reply-To: <20180608192027.284601-3-vsementsov@virtuozzo.com>
Am 08.06.2018 um 21:20 hat Vladimir Sementsov-Ogievskiy geschrieben:
> Make a separate function for compression to be parallelized later.
> - use .avail_aut field instead of .next_out to calculate size of
s/avail_aut/avail_out/
> compressed data. It looks more natural and it allows to keep dest to
> be void pointer
> - set avail_out to be at least one byte less than input, to be sure
> avoid inefficient compression earlier
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> block/qcow2.c | 74 +++++++++++++++++++++++++++++++++++++----------------------
> 1 file changed, 47 insertions(+), 27 deletions(-)
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 549fee9b69..d4dbe329ab 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -22,11 +22,13 @@
> * THE SOFTWARE.
> */
>
> +#define ZLIB_CONST
> +#include <zlib.h>
The first #include must always be "qemu/osdep.h". If you want to
separate zlib.h from the internal headers, you can move it down instead.
> #include "qemu/osdep.h"
> #include "block/block_int.h"
> #include "sysemu/block-backend.h"
> #include "qemu/module.h"
> -#include <zlib.h>
> #include "qcow2.h"
> #include "qemu/error-report.h"
> #include "qapi/error.h"
> @@ -3674,6 +3676,45 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset,
> return 0;
> }
>
> +/* qcow2_compress()
The first line of the comment should contain only the /*
> + *
> + * @dest - destination buffer, at least of @size-1 bytes
> + * @src - source buffer, @size bytes
> + *
> + * Returns: compressed size on success
> + * -1 if compression is inefficient
> + * -2 on any other error
> + */
The logic looks fine.
Initially I intended to request splitting the code motion from the
changes, but I see that this would probably only make things more
complicated, so I'm okay with leaving that as it is.
Kevin
next prev parent reply other threads:[~2018-06-14 13:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-08 19:20 [Qemu-devel] [PATCH 0/3] qcow2 compress threads Vladimir Sementsov-Ogievskiy
2018-06-08 19:20 ` [Qemu-devel] [PATCH 1/3] qemu-img: allow compressed not-in-order writes Vladimir Sementsov-Ogievskiy
2018-06-08 19:20 ` [Qemu-devel] [PATCH 2/3] qcow2: refactor data compression Vladimir Sementsov-Ogievskiy
2018-06-14 13:06 ` Kevin Wolf [this message]
2018-06-08 19:20 ` [Qemu-devel] [PATCH 3/3] qcow2: add compress threads Vladimir Sementsov-Ogievskiy
2018-06-14 13:16 ` Kevin Wolf
2018-06-14 13:19 ` Denis V. Lunev
2018-06-14 13:29 ` Kevin Wolf
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=20180614130613.GE8564@localhost.localdomain \
--to=kwolf@redhat.com \
--cc=den@openvz.org \
--cc=mreitz@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--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).