qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH for-2.10 14/16] block/qcow2: falloc/full preallo


From: Stefan Hajnoczi
Subject: Re: [Qemu-block] [PATCH for-2.10 14/16] block/qcow2: falloc/full preallocating growth
Date: Mon, 20 Mar 2017 11:29:00 +0000
User-agent: Mutt/1.7.1 (2016-10-04)

On Mon, Mar 13, 2017 at 10:41:15PM +0100, Max Reitz wrote:
> Implement the preallocation modes falloc and full for growing qcow2
> images.
> 
> Signed-off-by: Max Reitz <address@hidden>
> ---
>  block/qcow2.c | 36 +++++++++++++++++++++++++++++++++++-
>  1 file changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 80fb815b15..b6b08d70da 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -2604,7 +2604,9 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t 
> offset,
>      int64_t new_l1_size;
>      int ret;
>  
> -    if (prealloc != PREALLOC_MODE_OFF && prealloc != PREALLOC_MODE_METADATA) 
> {
> +    if (prealloc != PREALLOC_MODE_OFF && prealloc != PREALLOC_MODE_METADATA 
> &&
> +        prealloc != PREALLOC_MODE_FALLOC && prealloc != PREALLOC_MODE_FULL)

Now all cases are covered so this if statement can be dropped.  If you
are worried about new preallocation modes being added in the future then
the error_setg() can be moved into the switch statement's default case.

Attachment: signature.asc
Description: PGP signature


reply via email to

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