[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 11/15] block: Add list of all BlockDriverStates
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v6 11/15] block: Add list of all BlockDriverStates |
Date: |
Wed, 4 Nov 2015 19:57:43 +0100 |
Signed-off-by: Max Reitz <address@hidden>
---
block.c | 7 +++++++
include/block/block_int.h | 2 ++
2 files changed, 9 insertions(+)
diff --git a/block.c b/block.c
index 57e4b15..cf5dadc 100644
--- a/block.c
+++ b/block.c
@@ -78,6 +78,9 @@ struct BdrvStates bdrv_states =
QTAILQ_HEAD_INITIALIZER(bdrv_states);
static QTAILQ_HEAD(, BlockDriverState) graph_bdrv_states =
QTAILQ_HEAD_INITIALIZER(graph_bdrv_states);
+static QTAILQ_HEAD(, BlockDriverState) all_bdrv_states =
+ QTAILQ_HEAD_INITIALIZER(all_bdrv_states);
+
static QLIST_HEAD(, BlockDriver) bdrv_drivers =
QLIST_HEAD_INITIALIZER(bdrv_drivers);
@@ -266,6 +269,8 @@ BlockDriverState *bdrv_new(void)
bs->refcnt = 1;
bs->aio_context = qemu_get_aio_context();
+ QTAILQ_INSERT_TAIL(&all_bdrv_states, bs, bs_list);
+
return bs;
}
@@ -2128,6 +2133,8 @@ static void bdrv_delete(BlockDriverState *bs)
/* remove from list, if necessary */
bdrv_make_anon(bs);
+ QTAILQ_REMOVE(&all_bdrv_states, bs, bs_list);
+
g_free(bs);
}
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 4e0ed15..bde93e3 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -419,6 +419,8 @@ struct BlockDriverState {
QTAILQ_ENTRY(BlockDriverState) node_list;
/* element of the list of "drives" the guest sees */
QTAILQ_ENTRY(BlockDriverState) device_list;
+ /* element of the list of all BlockDriverStates (all_bdrv_states) */
+ QTAILQ_ENTRY(BlockDriverState) bs_list;
QLIST_HEAD(, BdrvDirtyBitmap) dirty_bitmaps;
int refcnt;
--
2.6.2
- [Qemu-devel] [PATCH v6 05/15] iotests: Make redirecting qemu's stderr optional, (continued)
- [Qemu-devel] [PATCH v6 08/15] block: Use blk_remove_bs() in blk_delete(), Max Reitz, 2015/11/04
- [Qemu-devel] [PATCH v6 09/15] blockdev: Use blk_remove_bs() in do_drive_del(), Max Reitz, 2015/11/04
- [Qemu-devel] [PATCH v6 10/15] block: Make bdrv_close() static, Max Reitz, 2015/11/04
- [Qemu-devel] [PATCH v6 11/15] block: Add list of all BlockDriverStates,
Max Reitz <=
- [Qemu-devel] [PATCH v6 12/15] blockdev: Keep track of monitor-owned BDS, Max Reitz, 2015/11/04
[Qemu-devel] [PATCH v6 13/15] block: Add blk_remove_all_bs(), Max Reitz, 2015/11/04
[Qemu-devel] [PATCH v6 14/15] block: Rewrite bdrv_close_all(), Max Reitz, 2015/11/04