qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH 26/54] block: Add BDRV_O_RESIZE for blk_new_open


From: Max Reitz
Subject: Re: [Qemu-block] [PATCH 26/54] block: Add BDRV_O_RESIZE for blk_new_open()
Date: Wed, 22 Feb 2017 15:51:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

On 21.02.2017 15:58, Kevin Wolf wrote:
> blk_new_open() is a convenience function that processes flags rather
> than QDict options as a simple way to just open an image file.
> 
> In order to keep it convenient in the future, it must automatically
> request the necessary permissions. This can easily be inferred from the
> flags for read and write, but we need another flag that tells us whether
> to get the resize permission.
> 
> We can't just always request it because that means that no block jobs
> can run on the resulting BlockBackend (which is something that e.g.
> qemu-img commit wants to do), but we also can't request it never because
> most of the .bdrv_create() implementations call blk_truncate().
> 
> The solution is to introduce another flag that is passed by all users
> that want to resize the image.
> 
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
>  block/parallels.c     | 3 ++-
>  block/qcow.c          | 3 ++-
>  block/qcow2.c         | 3 ++-
>  block/qed.c           | 3 ++-
>  block/vdi.c           | 3 ++-
>  block/vhdx.c          | 3 ++-
>  block/vmdk.c          | 6 ++++--
>  block/vpc.c           | 3 ++-
>  include/block/block.h | 1 +
>  qemu-img.c            | 2 +-
>  10 files changed, 20 insertions(+), 10 deletions(-)

Shouldn't writes beyond EOF with allow_write_beyond_eof count as a
resize, too? Then there would be one more place in qcow2.c and one in
sheepdog.c which require BDRV_O_RESIZE.

Max

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]