On Thu 17 Sep 2015 03:48:12 PM CEST, Kevin Wolf <kw...@redhat.com> 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