From patchwork Fri Oct 9 12:15:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 528313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:4830:134:3::10]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 87052140328 for ; Sat, 10 Oct 2015 03:42:33 +1100 (AEDT) Received: from lists.gnu.org ([208.118.235.17]:36095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkakY-0004ML-Td for incoming@patchwork.ozlabs.org; Fri, 09 Oct 2015 12:42:30 -0400 Received: from localhost ([::1]:39915 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkakY-0006nI-2h for incoming@patchwork.ozlabs.org; Fri, 09 Oct 2015 12:42:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkWbK-0008K2-46 for qemu-devel@nongnu.org; Fri, 09 Oct 2015 08:16:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkWbB-0005jO-4X for qemu-devel@nongnu.org; Fri, 09 Oct 2015 08:16:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkWaz-0005WP-D5; Fri, 09 Oct 2015 08:16:21 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id EBC54C0BE065; Fri, 9 Oct 2015 12:16:20 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-108.ams2.redhat.com [10.36.116.108]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t99CFjoK015625; Fri, 9 Oct 2015 08:16:18 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 9 Oct 2015 14:15:37 +0200 Message-Id: <1444392941-28704-13-git-send-email-kwolf@redhat.com> In-Reply-To: <1444392941-28704-1-git-send-email-kwolf@redhat.com> References: <1444392941-28704-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, berto@igalia.com, qemu-devel@nongnu.org, jcody@redhat.com, armbru@redhat.com, mreitz@redhat.com, stefanha@redhat.com, famz@redhat.com Subject: [Qemu-devel] [PATCH v3 12/16] block: Introduce parents list X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Fam Zheng --- block.c | 3 +++ include/block/block_int.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/block.c b/block.c index a2d6238..980437f 100644 --- a/block.c +++ b/block.c @@ -1090,6 +1090,7 @@ static BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs, }; QLIST_INSERT_HEAD(&parent_bs->children, child, next); + QLIST_INSERT_HEAD(&child_bs->parents, child, next_parent); return child; } @@ -1097,6 +1098,7 @@ static BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs, void bdrv_detach_child(BdrvChild *child) { QLIST_REMOVE(child, next); + QLIST_REMOVE(child, next_parent); g_free(child); } @@ -2038,6 +2040,7 @@ static void bdrv_move_reference_fields(BlockDriverState *bs_dest, /* keep the same entry in bdrv_states */ bs_dest->device_list = bs_src->device_list; bs_dest->blk = bs_src->blk; + bs_dest->parents = bs_src->parents; memcpy(bs_dest->op_blockers, bs_src->op_blockers, sizeof(bs_dest->op_blockers)); diff --git a/include/block/block_int.h b/include/block/block_int.h index cfcae52..52ea7c0 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -339,6 +339,7 @@ struct BdrvChild { BlockDriverState *bs; const BdrvChildRole *role; QLIST_ENTRY(BdrvChild) next; + QLIST_ENTRY(BdrvChild) next_parent; }; /* @@ -445,6 +446,7 @@ struct BlockDriverState { * parent node of this node. */ BlockDriverState *inherits_from; QLIST_HEAD(, BdrvChild) children; + QLIST_HEAD(, BdrvChild) parents; QDict *options; BlockdevDetectZeroesOptions detect_zeroes;