qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: "Denis Plotnikov" <dplotnikov@virtuozzo.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org,
	"Max Reitz" <mreitz@redhat.com>
Subject: Re: ImageInfo oddities regarding compression
Date: Fri, 27 Nov 2020 13:21:18 +0100	[thread overview]
Message-ID: <87ft4vq9c1.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20201127103216.GA4736@merkur.fritz.box> (Kevin Wolf's message of "Fri, 27 Nov 2020 11:32:16 +0100")

Kevin Wolf <kwolf@redhat.com> writes:

> Am 27.11.2020 um 11:14 hat Daniel P. Berrangé geschrieben:
>> On Fri, Nov 27, 2020 at 11:06:36AM +0100, Markus Armbruster wrote:
>> > ImageInfo has an optional member @compressed:
>> > 
>> >     ##
>> >     # @ImageInfo:
>> >     [...]
>> >     # @compressed: true if the image is compressed (Since 1.7)
>> > 
>> > Doc bug: neglects to specify the default.  I guess it's false.
>
> I think rather than false (definitely not compressed) it might just mean
> unknown, see below.
>
>> > The only user appears to be vmdk_get_extent_info().  Goes back to
>> > v1.7.0's commits
>> > 
>> >     f4c129a38a vmdk: Implment bdrv_get_specific_info
>> >     cbe82d7fb3 qapi: Add optional field 'compressed' to ImageInfo

Should it be in ImageInfoSpecificVmdk instead?

I know we can't just move it, and copy, deprecate, wait, delete may not
be worth the bother.  Sill, I'm curious :)

>> > ImageInfo also has an optional member @format-specific.
>> > 
>> > Doc bug: neglects to specify when it's present.  I assume it's always
>> > present when member @format has a value that has a non-empty variant in
>> > @format-specific's type ImageInfoSpecific.
>
> This seems to be the intention, yes.
>
>> > Format qcow2's variant is ImageInfoSpecificQCow2.  It has a mandatory
>> > member @compression-type.
>> > 
>> >    ##
>> >    # @Qcow2CompressionType:
>> >    #
>> >    # Compression type used in qcow2 image file
>> >    #
>> >    # @zlib: zlib compression, see <http://zlib.net/>
>> >    # @zstd: zstd compression, see <http://github.com/facebook/zstd>
>> >    #
>> >    # Since: 5.1
>> >    ##
>> >    { 'enum': 'Qcow2CompressionType',
>> >      'data': [ 'zlib', { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] }
>> > 
>> > Apparently, you can't have a qcow2 image without compression.  Correct?
>> > 
>> > Can you imagine a use case for "without compression"?
>> 
>> Yes & no. An image always has a compression type, either implicitly
>> zlib as the historical default, or explicitly as a type recorded in
>> the header.  This doesn't mean compression is used.
>> 
>> There may be zero or more clusters actually using compression.
>> Typically compression will never be used, but there's still an
>> associated compression type regardless.
>
> Right, so the correct answer to "is this image compressed?" is "unknown"
> for qcow2. Providing an answer would require checking all clusters in
> the image for the compression flag, which is not something we want to do
> for query-block. And even if we did that, it would still be unclear what
> to do with a partially compressed image.
>
> The @compression-type only tells you what format a compressed cluster
> uses if any compressed cluster exists in the image (or if a new
> compressed cluster is written to it). It doesn't mean that such clusters
> currently exist.

Makes sense.

If we had a compression type 'none', it would effectively tell us that
the image is definitely not compressed, because any "compressed"
clusters would use method none, i.e. be not compressed.  Observation,
not feature request.

>> I fell down this (thankfully shallow) rabbit hole because we also have
>> 
>>     { 'enum': 'MultiFDCompression',
>>       'data': [ 'none', 'zlib',
>>                 { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] }
>> 
>> I wonder whether we could merge them into a common type.

Looks like we could: current code would never report the additional
value 'none'.  Introspection would show it, though.  Seems unlikely to
cause trouble.  Observation, not demand.



  reply	other threads:[~2020-11-27 12:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-27 10:06 ImageInfo oddities regarding compression Markus Armbruster
2020-11-27 10:14 ` Daniel P. Berrangé
2020-11-27 10:32   ` Kevin Wolf
2020-11-27 12:21     ` Markus Armbruster [this message]
2020-11-27 15:25       ` Kevin Wolf
2020-11-27 16:52         ` Markus Armbruster
2020-11-30 17:36           ` Daniel P. Berrangé
2020-11-30 17:24     ` Eric Blake

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=87ft4vq9c1.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dplotnikov@virtuozzo.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).