qemu-stable
[Top][All Lists]
Advanced

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

Re: [Qemu-stable] [PATCH v4 1/8] block: Add "base" option to bdrv_get_bl


From: Paolo Bonzini
Subject: Re: [Qemu-stable] [PATCH v4 1/8] block: Add "base" option to bdrv_get_block_status
Date: Mon, 25 May 2015 16:43:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0


On 22/05/2015 05:40, Fam Zheng wrote:
> +{
> +    BlockDriverState *p;
> +    int64_t ret;
> +
> +    assert(bs != base);
> +    for (p = bs; p != base; p = p->backing_hd) {
> +        ret = bdrv_co_get_block_status(p, sector_num, nb_sectors, pnum);

It's a bit ugly to have different parameters for bdrv_get_block_status
and bdrv_co_get_block_status.

> +        if (ret < 0 || ret & BDRV_BLOCK_ALLOCATED) {
> +            break;
> +        }
> +    }
> +    return ret;
> +}
> +

I think BDRV_BLOCK_ALLOCATED will always be true if passing NULL as the
base, so patch 3 still needs a tweak.

But, more important, you need extra logic to correct the output value of
pnum, as in bdrv_is_allocated_above.  If you want, you can also
reimplemented bdrv_is_allocated_above on top of bdrv_get_block_status.

Paolo



reply via email to

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