diff options
author | Max Reitz <mreitz@redhat.com> | 2016-03-16 19:54:45 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-03-17 15:47:57 +0100 |
commit | 9aaf28c61dd3e3f4af125dd5d62625e4645f1958 (patch) | |
tree | a4dad699077994829e6850c3b64794593112448e /block.c | |
parent | 79720af640f3d23b446df4284a8f5b98efbb709d (diff) | |
download | qemu-9aaf28c61dd3e3f4af125dd5d62625e4645f1958.zip |
block: Remove bdrv_states list
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 31 |
1 files changed, 3 insertions, 28 deletions
@@ -55,8 +55,6 @@ #define NOT_DONE 0x7fffffff /* 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); @@ -226,10 +224,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) @@ -2230,26 +2225,10 @@ void bdrv_close_all(void) } } -/* 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. */ -void bdrv_device_remove(BlockDriverState *bs) -{ - QTAILQ_REMOVE(&bdrv_states, bs, device_list); - bs->device_list.tqe_prev = NULL; -} - -/* make a BlockDriverState anonymous by removing from bdrv_state and - * graph_bdrv_state list. - Also, NULL terminate the device_name to prevent double remove */ +/* make a BlockDriverState anonymous by removing from graph_bdrv_state list. + * 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. */ - if (bs->device_list.tqe_prev) { - bdrv_device_remove(bs); - } if (bs->node_name[0] != '\0') { QTAILQ_REMOVE(&graph_bdrv_states, bs, node_list); } @@ -2286,10 +2265,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); - } - bdrv_device_remove(from); } } |