Every entry in this list should be a root BDS and as such either be
anchored to a BlockBackend or be owned by the monitor.
Signed-off-by: Max Reitz
---
block.c | 30 +-
blockdev.c| 8
include/block/block.h | 1 -
include/block/block_int.h | 4
4 files changed, 1 insertion(+), 42 deletions(-)
diff --git a/block.c b/block.c
index c80675e..5b02990 100644
--- a/block.c
+++ b/block.c
@@ -73,8 +73,6 @@ struct BdrvDirtyBitmap {
#define NOT_DONE 0x7fff /* used while emulated sync operation in progress
*/
-struct BdrvStates bdrv_states = QTAILQ_HEAD_INITIALIZER(bdrv_states);
-
static QTAILQ_HEAD(, BlockDriverState) graph_bdrv_states =
QTAILQ_HEAD_INITIALIZER(graph_bdrv_states);
@@ -247,10 +245,7 @@ void bdrv_register(BlockDriver *bdrv)
BlockDriverState *bdrv_new_root(void)
{
-BlockDriverState *bs = bdrv_new();
-
-QTAILQ_INSERT_TAIL(&bdrv_states, bs, device_list);
-return bs;
+return bdrv_new();
}
BlockDriverState *bdrv_new(void)
@@ -2015,17 +2010,6 @@ void bdrv_close_all(void)
Also, NULL terminate the device_name to prevent double remove */
void bdrv_make_anon(BlockDriverState *bs)
{
-/*
- * Take care to remove bs from bdrv_states only when it's actually
- * in it. Note that bs->device_list.tqe_prev is initially null,
- * and gets set to non-null by QTAILQ_INSERT_TAIL(). Establish
- * the useful invariant "bs in bdrv_states iff bs->tqe_prev" by
- * resetting it to null on remove.
- */
-if (bs->device_list.tqe_prev) {
-QTAILQ_REMOVE(&bdrv_states, bs, device_list);
-bs->device_list.tqe_prev = NULL;
-}
if (bs->node_name[0] != '\0') {
QTAILQ_REMOVE(&graph_bdrv_states, bs, node_list);
}
@@ -2062,10 +2046,6 @@ static void change_parent_backing_link(BlockDriverState
*from,
}
if (from->blk) {
blk_set_bs(from->blk, to);
-if (!to->device_list.tqe_prev) {
-QTAILQ_INSERT_BEFORE(from, to, device_list);
-}
-QTAILQ_REMOVE(&bdrv_states, from, device_list);
}
}
@@ -2745,14 +2725,6 @@ BlockDriverState *bdrv_next_node(BlockDriverState *bs)
return QTAILQ_NEXT(bs, node_list);
}
-BlockDriverState *bdrv_next(BlockDriverState *bs)
-{
-if (!bs) {
-return QTAILQ_FIRST(&bdrv_states);
-}
-return QTAILQ_NEXT(bs, device_list);
-}
-
const char *bdrv_get_node_name(const BlockDriverState *bs)
{
return bs->node_name;
diff --git a/blockdev.c b/blockdev.c
index 934b9d8..f9c376f 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2143,12 +2143,6 @@ void qmp_blockdev_remove_medium(const char *device,
Error **errp)
goto out;
}
-/* This follows the convention established by bdrv_make_anon() */
-if (bs->device_list.tqe_prev) {
-QTAILQ_REMOVE(&bdrv_states, bs, device_list);
-bs->device_list.tqe_prev = NULL;
-}
-
blk_remove_bs(blk);
out:
@@ -2187,8 +2181,6 @@ static void qmp_blockdev_insert_anon_medium(const char
*device,
}
blk_insert_bs(blk, bs);
-
-QTAILQ_INSERT_TAIL(&bdrv_states, bs, device_list);
}
void qmp_blockdev_insert_medium(const char *device, const char *node_name,
diff --git a/include/block/block.h b/include/block/block.h
index f47c45a..1abfc70 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -394,7 +394,6 @@ BlockDriverState *bdrv_lookup_bs(const char *device,
Error **errp);
bool bdrv_chain_contains(BlockDriverState *top, BlockDriverState *base);
BlockDriverState *bdrv_next_node(BlockDriverState *bs);
-BlockDriverState *bdrv_next(BlockDriverState *bs);
int bdrv_is_encrypted(BlockDriverState *bs);
int bdrv_key_required(BlockDriverState *bs);
int bdrv_set_key(BlockDriverState *bs, const char *key);
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 7408eef..bc186b6 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -420,8 +420,6 @@ struct BlockDriverState {
char node_name[32];
/* element of the list of named nodes building the graph */
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;
/* element of the list of monitor-owned BDS */
@@ -478,8 +476,6 @@ extern BlockDriver bdrv_file;
extern BlockDriver bdrv_raw;
extern BlockDriver bdrv_qcow2;
-extern QTAILQ_HEAD(BdrvStates, BlockDriverState) bdrv_states;
-
/**
* bdrv_setup_io_funcs:
*
--
2.6.2