All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Clément Chigot" <chigot@adacore.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	 qemu-devel@nongnu.org, hreitz@redhat.com,
	 qemu-block@nongnu.org
Subject: Re: [PATCH 5/5] vvfat: add support for "size" options
Date: Wed, 05 Nov 2025 08:06:21 +0100	[thread overview]
Message-ID: <878qglot5e.fsf@pond.sub.org> (raw)
In-Reply-To: <CAJ307EgK9sqa6TNHRWo9uOkB=UXtu6CU+Zsaa_T6wcQjaUPngg@mail.gmail.com> ("Clément Chigot"'s message of "Fri, 31 Oct 2025 14:07:14 +0100")

Clément Chigot <chigot@adacore.com> writes:

> On Fri, Oct 31, 2025 at 12:57 PM Kevin Wolf <kwolf@redhat.com> wrote:

[...]

>> Imagine the simple case of a qcow2 image file used for the VM. You get
>> things stacked like this:
>>
>>         virtio-blk
>>             |
>>             v
>>           qcow2
>>             |
>>             v
>>           file
>>
>> You need to open them from bottom to top. Opening a qcow2 image must be
>> able to read from the file, so first the file layer must be opened. And
>> obvious a virtio-blk device can only use the image after the qcow2
>> layered has been opened.
>>
>> In your case, this is raw over vvfat. vvfat gets opened first, and then
>> raw gets instantiated on top of it. (If you use format=vvfat, then the
>> raw layer is left away.)

Desirable, because it's simpler.

>> Top level options you give to -drive go to the topmost block driver. You
>> should be able to still set it on the vvfat level with -drive
>> format=raw,file.size=... Deciding which option goes to which node is
>> part of the (rather complicated) bdrv_open() logic in block.c.
>>
>> What raw does when a size option is given is that it just truncates the
>> lower level to the given size. So as vvfat doesn't know the size, it
>> still creates a 504 MB image, but raw shows only the first part of it to
>> the guest. This results not only in an invalid partition table, but also
>> means that as soon as vvfat decides to put a cluster after your limited
>> size, you'll see filesystem corruption in the guest.
>>
>> So your approach to deal with this in vvfat and create a smaller
>> filesystem to start with does look right to me.
>
> Ok thanks for the explanation. It's a bit counter-intuitive that
> "size" does not propagate to lower levels, especially if it generates
> wrong ones behind the scene.

Format "raw" was designed to do nothing, so we have a "do nothing"
format for the rigid "format over protocol" system.

We've long acquired the means to use a protocol without a format.  This
made "raw" redundant.  I advocate omitting it, because it only
complicates matters.

Except when you want the one feature "raw" provides beyond "do nothing":
carve a slice with options offset and size (commit 2fdc70452a5 "raw_bsd:
add offset and size options", 2016).

>                              But IIUC, this would be a much more
> complex patch (i.e. changing bdrv_open logic).

"size" is for slicing.  Can't see how it could simultaneously be
forwarded to the next block driver.

> Hence, I'm fine keeping this series narrowed to "format=vvfat".
>
>
>> Kevin
>>



  reply	other threads:[~2025-11-05  7:07 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03  7:57 [PATCH 0/5] block/vvfat: introduce "size" option Clément Chigot
2025-09-03  7:57 ` [PATCH 1/5] vvfat: introduce no-mbr option Clément Chigot
2025-10-23 18:20   ` Kevin Wolf
2025-10-29  8:37     ` Clément Chigot
2025-10-29 10:56       ` Kevin Wolf
2025-10-29 13:44         ` Clément Chigot
2025-09-03  7:57 ` [PATCH 2/5] vvfat: move fat_type check prior to size setup Clément Chigot
2025-10-23 18:39   ` Kevin Wolf
2025-10-29 13:48     ` Clément Chigot
2025-10-29 13:58       ` BALATON Zoltan
2025-10-29 16:05         ` Kevin Wolf
2025-09-03  7:57 ` [PATCH 3/5] vvfat: add a define for SECTOR_SIZE Clément Chigot
2025-10-23 18:47   ` Kevin Wolf
2025-09-03  7:57 ` [PATCH 4/5] vvfat: move size parameters within driver structure Clément Chigot
2025-09-03  7:57 ` [PATCH 5/5] vvfat: add support for "size" options Clément Chigot
2025-10-23 19:29   ` Kevin Wolf
2025-10-24  8:30     ` Markus Armbruster
2025-10-24  9:23       ` Clément Chigot
2025-10-27 12:09         ` Markus Armbruster
2025-10-28 14:54           ` Clément Chigot
2025-10-31  7:46             ` Markus Armbruster
2025-10-31  9:47               ` Clément Chigot
2025-10-31 11:56                 ` Kevin Wolf
2025-10-31 13:07                   ` Clément Chigot
2025-11-05  7:06                     ` Markus Armbruster [this message]
2025-11-05  7:08     ` Markus Armbruster
2025-11-05  9:35       ` Kevin Wolf
2025-11-05 10:15         ` Clément Chigot
2025-11-07  8:06         ` Markus Armbruster
2025-09-15  8:47 ` [PATCH 0/5] block/vvfat: introduce "size" option Clément Chigot
2025-10-07  7:43 ` Clément Chigot
2025-11-12 12:38 ` Richard W.M. Jones
2025-11-12 13:09   ` Clément Chigot
2025-11-13  8:41   ` Kevin Wolf
2025-11-13  9:13     ` Richard W.M. Jones
2025-11-13 13:13       ` 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=878qglot5e.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=chigot@adacore.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.