qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 01/21] qcow2: Add two new fields to BDRVQcowStat


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 01/21] qcow2: Add two new fields to BDRVQcowState
Date: Mon, 10 Nov 2014 12:00:03 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 11/10/2014 06:45 AM, Max Reitz wrote:
> Add two new fields regarding refcount information (the bit width of
> every entry and the maximum refcount value) to the BDRVQcowState.
> 
> Signed-off-by: Max Reitz <address@hidden>
> ---
>  block/qcow2-refcount.c | 2 +-
>  block/qcow2.c          | 9 +++++++++
>  block/qcow2.h          | 2 ++
>  3 files changed, 12 insertions(+), 1 deletion(-)

Reviewed-by: Eric Blake <address@hidden>

> +++ b/block/qcow2.c
> @@ -684,6 +684,15 @@ static int qcow2_open(BlockDriverState *bs, QDict 
> *options, int flags,
>          goto fail;
>      }
>      s->refcount_order = header.refcount_order;
> +    s->refcount_bits = 1 << s->refcount_order;

Not shown is the context where a few lines before still enforces
refcount_order==4, so this doesn't overflow.  When later patches relax
that, I'll make sure we don't overflow here as well.

> +    if (s->refcount_order < 6) {
> +        s->refcount_max = (UINT64_C(1) << s->refcount_bits) - 1;

I don't see the UINT64_C macro get much use, but like it better than
casting :)

> +    } else {

I don't know if Coverity might complain about dead code during bisection
(since we can't get here until we relax refcount_order to not be forced
to 4), but that's a layer beyond making sure 'make check' works so I
don't care.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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