qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH 08/16] block: Manage backing file references in


From: Alberto Garcia
Subject: Re: [Qemu-block] [PATCH 08/16] block: Manage backing file references in bdrv_set_backing_hd()
Date: Mon, 28 Sep 2015 14:29:39 +0200
User-agent: Notmuch/0.13.2 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu)

On Thu 17 Sep 2015 03:48:12 PM CEST, Kevin Wolf <address@hidden> wrote:
> --- a/block/stream.c
> +++ b/block/stream.c
> @@ -55,28 +55,7 @@ static int coroutine_fn stream_populate(BlockDriverState 
> *bs,
>  static void close_unused_images(BlockDriverState *top, BlockDriverState 
> *base,
>                                  const char *base_id)
>  {
> -    BlockDriverState *intermediate;
> -    intermediate = top->backing ? top->backing->bs : NULL;
> -
> -    /* Must assign before bdrv_delete() to prevent traversing dangling 
> pointer
> -     * while we delete backing image instances.
> -     */
>      bdrv_set_backing_hd(top, base);
> -
> -    while (intermediate) {
> -        BlockDriverState *unused;
> -
> -        /* reached base */
> -        if (intermediate == base) {
> -            break;
> -        }
> -
> -        unused = intermediate;
> -        intermediate = intermediate->backing ? intermediate->backing->bs : 
> NULL;
> -        bdrv_set_backing_hd(unused, NULL);
> -        bdrv_unref(unused);
> -    }
> -
>      bdrv_refresh_limits(top, NULL);
>  }


bdrv_refresh_limits(bs, NULL) is already called at the end of
bdrv_set_backing_hd(), so there's no need to call it again here.

And then close_unused_images() is used only once in this file and it
would only contain the bdrv_set_backing_hd() call, so you don't need a
separate function anymore.

Berto



reply via email to

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