qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v6 14/24] qcow2: Allow creation with refcount or


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v6 14/24] qcow2: Allow creation with refcount order != 4
Date: Wed, 18 Feb 2015 12:01:33 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Am 10.02.2015 um 21:28 hat Max Reitz geschrieben:
> Add a creation option to qcow2 for setting the refcount order of images
> to be created, and respect that option's value.
> 
> This breaks some test outputs, fix them.
> 
> Signed-off-by: Max Reitz <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>
> Reviewed-by: Stefan Hajnoczi <address@hidden>
> ---
>  block/qcow2.c              |  20 +++++++++
>  include/block/block_int.h  |   1 +
>  tests/qemu-iotests/049.out | 108 
> ++++++++++++++++++++++-----------------------
>  tests/qemu-iotests/082.out |  41 ++++++++++++++---
>  tests/qemu-iotests/085.out |  38 ++++++++--------
>  5 files changed, 128 insertions(+), 80 deletions(-)
> 
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 65f7e91..99f6604 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -2077,6 +2077,17 @@ static int qcow2_create(const char *filename, QemuOpts 
> *opts, Error **errp)
>          goto finish;
>      }
>  
> +    refcount_bits = qemu_opt_get_number_del(opts, BLOCK_OPT_REFCOUNT_BITS,
> +                                            refcount_bits);

This truncates the uint64_t result to an int, so the code accepts inputs
like refcount_bits=4294967297 (treating it as refcount_bits=1).

> +    if (refcount_bits <= 0 || refcount_bits > 64 ||

Should we have a constant MAX_REFCOUNT_ORDER that is shared between
qcow2_open() and qcow2_create()?

> +        !is_power_of_2(refcount_bits))
> +    {
> +        error_setg(errp, "Refcount width must be a power of two and may not "
> +                   "exceed 64 bits");
> +        ret = -EINVAL;
> +        goto finish;
> +    }
> +

Kevin



reply via email to

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