diff mbox

[v11,02/12] Store parent BDS in BdrvChild

Message ID 1446548329-17475-3-git-send-email-wency@cn.fujitsu.com
State New
Headers show

Commit Message

Wen Congyang Nov. 3, 2015, 10:58 a.m. UTC
We need to access the parent BDS to get the root BDS.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
---
 block.c                   | 1 +
 include/block/block_int.h | 1 +
 2 files changed, 2 insertions(+)
diff mbox

Patch

diff --git a/block.c b/block.c
index 1d6c115..52a91ad 100644
--- a/block.c
+++ b/block.c
@@ -1092,6 +1092,7 @@  BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs,
     BdrvChild *child = g_new(BdrvChild, 1);
     *child = (BdrvChild) {
         .bs     = child_bs,
+        .parent = parent_bs,
         .role   = child_role,
     };
 
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 87af5ae..3285739 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -342,6 +342,7 @@  extern const BdrvChildRole child_format;
 
 struct BdrvChild {
     BlockDriverState *bs;
+    BlockDriverState *parent;
     const BdrvChildRole *role;
     QLIST_ENTRY(BdrvChild) next;
     QLIST_ENTRY(BdrvChild) next_parent;