public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Hanna Czenczek <hreitz@redhat.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH 2/5] block: Introduce BDRV_O_NO_DATA_{WRITE,RESIZE}
Date: Mon, 2 Mar 2026 15:30:41 +0100	[thread overview]
Message-ID: <aaWfEfuBZGW4BHPD@redhat.com> (raw)
In-Reply-To: <20260205144737.31131-3-hreitz@redhat.com>

Am 05.02.2026 um 15:47 hat Hanna Czenczek geschrieben:
> Add BDS flags that prevent taking WRITE and/or RESIZE permissions on
> pure data (no metadata) children.  These are going to be used by qcow2
> during formatting, when we need write access to format the metadata
> file, but no write access to an external data file.  This will allow
> creating a qcow2 image for a raw image while the latter is currently in
> use by the VM.
> 
> Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
> ---
>  include/block/block-common.h | 11 +++++++++++
>  block.c                      | 15 +++++++++++++++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/include/block/block-common.h b/include/block/block-common.h
> index c8c626daea..504f6aa113 100644
> --- a/include/block/block-common.h
> +++ b/include/block/block-common.h
> @@ -245,6 +245,17 @@ typedef enum {
>  
>  #define BDRV_O_CBW_DISCARD_SOURCE 0x80000 /* for copy-before-write filter */
>  
> +/*
> + * Promise not to write any data to pure (non-metadata-bearing) data storage
> + * children, so we don't need the WRITE permission for them.
> + * For image creation, formatting requires write access to the image, but not
> + * necessarily to its pure storage children.  This allows creating an image on
> + * top of an existing raw storage image that is already attached to the VM.
> + */
> +#define BDRV_O_NO_DATA_WRITE  0x100000

Can't we just use BDRV_O_NO_IO for this one? It is stricter because it
doesn't allow reading either, but I don't think image creation ever
requires reading from the image?

> +/* Same as O_NO_DATA_WRITE, but for resizing */
> +#define BDRV_O_NO_DATA_RESIZE 0x200000

How does this differ from BDRV_O_RESIZE (apart from being negative)?
Doesn't resizing always refer to the data part?

Kevin



  reply	other threads:[~2026-03-02 14:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05 14:47 [PATCH 0/5] qcow2: Suppress data-file WRITE during creation Hanna Czenczek
2026-02-05 14:47 ` [PATCH 1/5] qcow2: Skip data-file resize if possible Hanna Czenczek
2026-02-05 14:47 ` [PATCH 2/5] block: Introduce BDRV_O_NO_DATA_{WRITE,RESIZE} Hanna Czenczek
2026-03-02 14:30   ` Kevin Wolf [this message]
2026-03-04 14:20     ` Hanna Czenczek
2026-03-04 16:13       ` Kevin Wolf
2026-03-06 10:20         ` Hanna Czenczek
2026-03-06 11:12           ` Kevin Wolf
2026-03-06 11:28             ` Hanna Czenczek
2026-03-06 13:04               ` Kevin Wolf
2026-02-05 14:47 ` [PATCH 3/5] qcow2: Preallocation: Do not COW after disk end Hanna Czenczek
2026-02-05 14:47 ` [PATCH 4/5] qcow2: Suppress data-file WRITE/RESIZE if possible Hanna Czenczek
2026-02-05 14:47 ` [PATCH 5/5] iotests: Add qcow2-live-data-file test Hanna Czenczek

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=aaWfEfuBZGW4BHPD@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hreitz@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