From: Max Reitz <mreitz@redhat.com>
To: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: kwolf@redhat.com, den@openvz.org, vsementsov@virtuozzo.com,
armbru@redhat.com
Subject: Re: [PATCH v12 1/3] block: introduce compress filter driver
Date: Fri, 20 Dec 2019 15:52:48 +0100 [thread overview]
Message-ID: <4c0f2379-7baf-7aa3-ab5f-a7046793d730@redhat.com> (raw)
In-Reply-To: <1575288906-551879-2-git-send-email-andrey.shinkevich@virtuozzo.com>
[-- Attachment #1.1: Type: text/plain, Size: 2124 bytes --]
On 02.12.19 13:15, Andrey Shinkevich wrote:
> Allow writing all the data compressed through the filter driver.
> The written data will be aligned by the cluster size.
> Based on the QEMU current implementation, that data can be written to
> unallocated clusters only. May be used for a backup job.
>
> Suggested-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> block/Makefile.objs | 1 +
> block/filter-compress.c | 168 ++++++++++++++++++++++++++++++++++++++++++++++++
> qapi/block-core.json | 10 +--
> 3 files changed, 175 insertions(+), 4 deletions(-)
> create mode 100644 block/filter-compress.c
[...]
> diff --git a/block/filter-compress.c b/block/filter-compress.c
> new file mode 100644
> index 0000000..4d756ea
> --- /dev/null
> +++ b/block/filter-compress.c
> @@ -0,0 +1,168 @@
[...]
> +static int compress_open(BlockDriverState *bs, QDict *options, int flags,
> + Error **errp)
> +{
> + bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, false,
> + errp);
> + if (!bs->file) {
> + return -EINVAL;
> + }
> +
> + if (!bs->file->bs->drv || !block_driver_can_compress(bs->file->bs->drv)) {
> + error_setg(errp,
> + "Compression is not supported for underlying format: %s",
> + bdrv_get_format_name(bs->file->bs));
bdrv_get_format_name() returns NULL if bs->file->bs->drv is NULL. I’m
sure g_strdup_vprintf() handles %s with a NULL string gracefully in
practice, but I can’t find that specified anywhere. So even though I’m
well aware I’m being a bit stupid about a minor edge case, I’m hesitant
to accept this patch as-is.
Obviously the solution can be as simple as bdrv_get_format_name(...) ?:
"(no format)".
Well, actually, I can be a bit less stupid about it and just propose
merging that change in myself. Would that be OK for you?
(The rest looks good to me.)
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-12-20 14:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-02 12:15 [PATCH v12 0/3] qcow2: advanced compression options Andrey Shinkevich
2019-12-02 12:15 ` [PATCH v12 1/3] block: introduce compress filter driver Andrey Shinkevich
2019-12-20 14:52 ` Max Reitz [this message]
2019-12-20 15:11 ` Andrey Shinkevich
2019-12-02 12:15 ` [PATCH v12 2/3] qcow2: Allow writing compressed data of multiple clusters Andrey Shinkevich
2020-04-09 16:50 ` Alberto Garcia
2020-04-09 18:39 ` Vladimir Sementsov-Ogievskiy
2020-04-10 0:12 ` Andrey Shinkevich
2020-04-10 5:10 ` Vladimir Sementsov-Ogievskiy
2020-04-10 11:12 ` Alberto Garcia
2020-04-10 11:44 ` Vladimir Sementsov-Ogievskiy
2019-12-02 12:15 ` [PATCH v12 3/3] tests/qemu-iotests: add case to write " Andrey Shinkevich
2019-12-18 11:46 ` [PATCH v12 0/3] qcow2: advanced compression options Andrey Shinkevich
2019-12-20 15:45 ` Max Reitz
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=4c0f2379-7baf-7aa3-ab5f-a7046793d730@redhat.com \
--to=mreitz@redhat.com \
--cc=andrey.shinkevich@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=den@openvz.org \
--cc=kwolf@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).