From: Denis Plotnikov <dplotnikov@virtuozzo.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-devel@nongnu.org
Cc: kwolf@redhat.com, berto@igalia.com, qemu-block@nongnu.org,
armbru@redhat.com, mreitz@redhat.com, den@openvz.org
Subject: Re: [PATCH v8 1/4] qcow2: introduce compression type feature
Date: Mon, 23 Mar 2020 15:22:45 +0300 [thread overview]
Message-ID: <ea557760-b2a5-db20-cb48-fa94a4a2d1e9@virtuozzo.com> (raw)
In-Reply-To: <401c0627-a7ad-3434-a861-69f4a5d58d21@virtuozzo.com>
On 23.03.2020 11:00, Vladimir Sementsov-Ogievskiy wrote:
> 21.03.2020 17:34, Denis Plotnikov wrote:
>> The patch adds some preparation parts for incompatible compression type
>> feature to qcow2 allowing the use different compression methods for
>> image clusters (de)compressing.
>>
>> It is implied that the compression type is set on the image creation and
>> can be changed only later by image conversion, thus compression type
>> defines the only compression algorithm used for the image, and thus,
>> for all image clusters.
>>
>> The goal of the feature is to add support of other compression methods
>> to qcow2. For example, ZSTD which is more effective on compression
>> than ZLIB.
>>
>> The default compression is ZLIB. Images created with ZLIB compression
>> type
>> are backward compatible with older qemu versions.
>>
>> Adding of the compression type breaks a number of tests because now the
>> compression type is reported on image creation and there are some
>> changes
>> in the qcow2 header in size and offsets.
>>
>> The tests are fixed in the following ways:
>> * filter out compression_type for many tests
>> * fix header size, feature table size and backing file offset
>> affected tests: 031, 036, 061, 080
>> header_size +=8: 1 byte compression type
>> 7 bytes padding
>> feature_table += 48: incompatible feature compression type
>> backing_file_offset += 56 (8 + 48 -> header_change +
>> feature_table_change)
>> * add "compression type" for test output matching when it isn't
>> filtered
>> affected tests: 049, 060, 061, 065, 144, 182, 242, 255
>>
>> Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
>> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>
> [...]
>
>> @@ -4859,6 +4949,7 @@ static ImageInfoSpecific
>> *qcow2_get_specific_info(BlockDriverState *bs,
>> .data_file = g_strdup(s->image_data_file),
>> .has_data_file_raw = has_data_file(bs),
>> .data_file_raw = data_file_is_raw(bs),
>> + .compression_type = s->compression_type,
>> };
>> } else {
>> /* if this assertion fails, this probably means a new
>> version was
>> @@ -5248,6 +5339,22 @@ static int
>> qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
>> "images");
>> return -EINVAL;
>> }
>> + } else if (!strcmp(desc->name, BLOCK_OPT_COMPRESSION_TYPE)) {
>> + int compression_type =
>> + qapi_enum_parse(&Qcow2CompressionType_lookup,
>> + qemu_opt_get(opts,
>> BLOCK_OPT_COMPRESSION_TYPE),
>> + -1, errp);
>> +
>> + if (compression_type == -EINVAL) {
>
> You should compare to -1, as qapi_enum_parse returns given default on
> error.
ok
>
>> + error_setg(errp, "Unknown compression type");
>
> and errp is already set (ofcourse, if qemu_opt_get returned non NULL,
> but I hope it is guaranteed by if (!strcmp(desc->name,
> BLOCK_OPT_COMPRESSION_TYPE)) condition
I wouldn't propagate the error from qapi_enum_parse because it looks
like "invalid parameter value: foo". I think it's better to print
"Unknown compression type: foo"
>
>> + return -ENOTSUP;
>> + }
>> +
>> + if (compression_type != s->compression_type) {
>> + error_setg(errp, "Changing the compression type "
>> + "is not supported");
>> + return -ENOTSUP;
>> + }
>> } else {
>> /* if this point is reached, this probably means a new
>> option was
>> * added without having it covered here */
>> @@ -5516,6 +5623,12 @@ static QemuOptsList qcow2_create_opts = {
>> .help = "Width of a reference count entry in bits",
>> .def_value_str = "16"
>> },
>> + {
>> + .name = BLOCK_OPT_COMPRESSION_TYPE,
>> + .type = QEMU_OPT_STRING,
>> + .help = "Compression method used for image cluster
>> compression",
>> + .def_value_str = "zlib"
>> + },
>> { /* end of list */ }
>> }
>> };
>
>
> [...]
>
>
next prev parent reply other threads:[~2020-03-23 12:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-21 14:34 [PATCH v8 0/4] qcow2: Implement zstd cluster compression method Denis Plotnikov
2020-03-21 14:34 ` [PATCH v8 1/4] qcow2: introduce compression type feature Denis Plotnikov
2020-03-23 8:00 ` Vladimir Sementsov-Ogievskiy
2020-03-23 12:22 ` Denis Plotnikov [this message]
2020-03-23 12:26 ` Vladimir Sementsov-Ogievskiy
2020-03-23 12:30 ` Denis Plotnikov
2020-03-21 14:34 ` [PATCH v8 2/4] qcow2: rework the cluster compression routine Denis Plotnikov
2020-03-21 14:34 ` [PATCH v8 3/4] qcow2: add zstd cluster compression Denis Plotnikov
2020-03-23 8:44 ` Vladimir Sementsov-Ogievskiy
2020-03-23 10:20 ` Denis Plotnikov
2020-03-23 12:05 ` Vladimir Sementsov-Ogievskiy
2020-03-23 12:47 ` Alberto Garcia
2020-03-23 12:55 ` Denis Plotnikov
2020-03-21 14:34 ` [PATCH v8 4/4] iotests: 287: add qcow2 compression type test Denis Plotnikov
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=ea557760-b2a5-db20-cb48-fa94a4a2d1e9@virtuozzo.com \
--to=dplotnikov@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=berto@igalia.com \
--cc=den@openvz.org \
--cc=kwolf@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).