qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] block: support dropping active in bdrv_drop_


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2] block: support dropping active in bdrv_drop_intermediate
Date: Fri, 18 Oct 2013 08:37:39 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0

On 10/15/2013 01:25 AM, Fam Zheng wrote:
> There is only one failure point: bdrv_change_backing_file in this
> function, so we can drop the qlist and try to change the backing file
> before deleting anything.
> 
> This way bdrv_drop_intermediate is simplified while keeping the
> operation transactional. A bonus is dropping an active BDS is supported
> too by swapping the base and top. Although no caller uses this yet, the
> comment is updated to reflect the change.
> 
> Signed-off-by: Fam Zheng <address@hidden>
> 
> ---
> v2: check for active, top and base being in a backing chain. (Jeff)
> 
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  block.c        | 103 
> ++++++++++++++++++++-------------------------------------
>  block/commit.c |   1 +
>  2 files changed, 37 insertions(+), 67 deletions(-)
> 

>  
>      if (!top->drv || !base->drv) {
>          goto exit;
>      }

So base->drv is non-NULL if we get here...

> +    if (active != top) {
> +        /* If there's an overlay, its backing_hd points to top's BDS now,
> +         * the top image is dropped but this BDS structure is kept and 
> swapped
> +         * with base, this way we keep the pointers valid after dropping top 
> */
> +        overlay = bdrv_find_overlay(active, top);
> +        if (!overlay) {
> +            goto exit;
> +        }
> +        ret = bdrv_change_backing_file(overlay, base->filename,
> +                                       base->drv ?

...yet you are checking it for NULL here.

-- 
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]