qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: John Snow <jsnow@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 0/3] block: Make various formats' block_status recurse again
Date: Tue, 13 Aug 2019 16:48:36 +0200	[thread overview]
Message-ID: <cb8a761c-48bb-52b8-8079-b8220a32bc63@redhat.com> (raw)
In-Reply-To: <62114b6e-803d-5eec-df7e-e77708f065c6@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 3391 bytes --]

On 12.08.19 23:45, John Snow wrote:
> 
> 
> On 8/12/19 3:11 PM, Max Reitz wrote:
>> On 12.08.19 20:39, John Snow wrote:
>>>
>>>
>>> On 7/25/19 11:55 AM, Max Reitz wrote:
>>>> Hi,
>>>>
>>>> 69f47505ee66afaa513305de0c1895a224e52c45 changed block_status so that it
>>>> would only go down to the protocol layer if the format layer returned
>>>> BDRV_BLOCK_RECURSE, thus indicating that it has no sufficient
>>>> information whether a given range in the image is zero or not.
>>>> Generally, this is because the image is preallocated and thus all ranges
>>>> appear as zeroes.
>>>>
>>>> However, it only implemented this preallocation detection for qcow2.
>>>> There are more formats that support preallocation, though: vdi, vhdx,
>>>> vmdk, vpc.  (Funny how they all start with “v”.)
>>>>
>>>> For vdi, vmdk, and vpc, the fix is rather simple, because they really
>>>> have different subformats depending on whether an image is preallocated
>>>> or not.  This makes the check very simple.
>>>>
>>>> vhdx is more like qcow2, where after the image has been created, it
>>>> isn’t clear whether it’s been preallocated or everything is allocated
>>>> because everything was already written to.  69f47505ee added a heuristic
>>>> to qcow2 to get around this, but I think that’s too much for vhdx.  I
>>>> just left it unfixed, because I don’t care that much, honestly (and I
>>>> don’t think anyone else does).
>>>>
>>>
>>> What's the practical outcome of that, and is the limitation documented
>>> somewhere?
>>
>> The outcome is that it if you preallocate a vhdx image
>> (subformat=fixed), you’ll see that all sectors contain data, even if
>> they may be zero sectors on the filesystem level.
>>
>> I don’t think it’s user-visible whatsoever.
>>
> 
> But it might mean that doing things with sync=top might over-allocate
> data depending on the destination, wouldn't it?
> 
> That's not crucial, but it's possibly visible, no?

I don’t think it has anything to do with sync=top because whether a
block is zero on the protocol level has nothing to do with whether it is
allocated on the format level.

It may make a difference for convert which uses block_status to inquire
the zero status.  However, it also does zero-detection, so...

>>> (I'm fine with not fixing it, I just want it documented somehow.)
>>
>> I am really not inclined to start any documentation on the
>> particularities with which qemu handles vhdx images.
>>
>> (Especially so considering we don’t even have any documentation on the
>> qcow2 case.  The stress in my paragraph was “heuristic”.  If you
>> preallocate a qcow2 image, but then discard enough sectors that the
>> heuristic thinks you didn’t, you’ll have the same effect.  Or if you
>> grow a preallocated image without preallocating the new area.)
>>
>> Max
>>
> 
> "But our qcow2 docs are also bad" is the kind of argument I can't
> *really* disagree with, but...

My main argument is that nobody would read the vhdx docs anyway.

Max

> (I wish we did have a documentation manual per-format that mentioned
> some gotchas and general info about each format, but I can't really ask
> you to do that now: I just worry when I see patches like this that the
> knowledge or memory that there ever was a quirk will vanish immediately.)
> 
> --js
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-08-13 14:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25 15:55 [Qemu-devel] [PATCH 0/3] block: Make various formats' block_status recurse again Max Reitz
2019-07-25 15:55 ` [Qemu-devel] [PATCH 1/3] vdi: Make block_status recurse for fixed images Max Reitz
2019-08-12 14:47   ` Vladimir Sementsov-Ogievskiy
2019-07-25 15:55 ` [Qemu-devel] [PATCH 2/3] vmdk: Make block_status recurse for flat extents Max Reitz
2019-08-12 14:59   ` Vladimir Sementsov-Ogievskiy
2019-07-25 15:55 ` [Qemu-devel] [PATCH 3/3] vpc: Do not return RAW from block_status Max Reitz
2019-08-12 15:33   ` Vladimir Sementsov-Ogievskiy
2019-08-12 15:56     ` Max Reitz
2019-08-12 16:50       ` Vladimir Sementsov-Ogievskiy
2019-08-12 19:07         ` Max Reitz
2019-08-13 10:38       ` Kevin Wolf
2019-08-13 14:49         ` Max Reitz
2019-08-12 18:39 ` [Qemu-devel] [Qemu-block] [PATCH 0/3] block: Make various formats' block_status recurse again John Snow
2019-08-12 19:11   ` Max Reitz
2019-08-12 21:45     ` John Snow
2019-08-13 14:48       ` Max Reitz [this message]
2019-08-13 22:35         ` John Snow
2019-08-15 15:49 ` [Qemu-devel] " 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=cb8a761c-48bb-52b8-8079-b8220a32bc63@redhat.com \
    --to=mreitz@redhat.com \
    --cc=jsnow@redhat.com \
    --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).