Received: from eggs.gnu.org ([2001:4830:134:3::10]:57158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgXYx-0007fS-0y for qemu-devel@nongnu.org; Mon, 28 Sep 2015 08:29:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgXYw-0008Ne-5I for qemu-devel@nongnu.org; Mon, 28 Sep 2015 08:29:46 -0400 From: Alberto Garcia In-Reply-To: <1442497700-2536-9-git-send-email-kwolf@redhat.com> References: <1442497700-2536-1-git-send-email-kwolf@redhat.com> <1442497700-2536-9-git-send-email-kwolf@redhat.com> Date: Mon, 28 Sep 2015 14:29:39 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH 08/16] block: Manage backing file references in bdrv_set_backing_hd() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: jcody@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, mreitz@redhat.com On Thu 17 Sep 2015 03:48:12 PM CEST, Kevin Wolf 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