Received: from eggs.gnu.org ([2001:4830:134:3::10]:60154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zle5P-000293-2B for qemu-devel@nongnu.org; Mon, 12 Oct 2015 10:28:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zle5N-0004Nl-Dc for qemu-devel@nongnu.org; Mon, 12 Oct 2015 10:28:22 -0400 From: Alberto Garcia In-Reply-To: <1444392941-28704-14-git-send-email-kwolf@redhat.com> References: <1444392941-28704-1-git-send-email-kwolf@redhat.com> <1444392941-28704-14-git-send-email-kwolf@redhat.com> Date: Mon, 12 Oct 2015 16:27:55 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH v3 13/16] block: Implement bdrv_append() without bdrv_swap() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: famz@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, mreitz@redhat.com On Fri 09 Oct 2015 02:15:38 PM CEST, Kevin Wolf wrote: > +static void change_parent_backing_link(BlockDriverState *from, > + BlockDriverState *to) > +{ > + BdrvChild *c, *next; > + > + QLIST_FOREACH_SAFE(c, &from->parents, next_parent, next) { > + assert(c->role != &child_backing); > + c->bs = to; > + QLIST_REMOVE(c, next_parent); > + QLIST_INSERT_HEAD(&to->parents, c, next_parent); > + bdrv_ref(to); > + bdrv_unref(from); > + } > + if (from->blk) { > + blk_set_bs(from->blk, to); > + if (!to->device_list.tqe_prev) { > + QTAILQ_INSERT_BEFORE(from, to, device_list); > + } Is it even possible that this last condition is false? In what case would 'to' be already in bdrv_states? I understand that it would mean that it would already be attached to a BlockBackend, but that's not possible in this case. Berto