summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-03-18 10:46:57 +0100
committerKevin Wolf <kwolf@redhat.com>2016-03-30 11:59:32 +0200
commit63eaaae08cb7738311f73d1a7e6e6a68ddf60688 (patch)
tree905d22ce4c2b0dc489c94534498ebc63166d3f23 /block.c
parent553934db664ecee676650fac0330dceff3531736 (diff)
downloadqemu-63eaaae08cb7738311f73d1a7e6e6a68ddf60688.zip
block: Remove bdrv_make_anon()
The call in hmp_drive_del() is dead code because blk_remove_bs() is called a few lines above. The only other remaining user is bdrv_delete(), which only abuses bdrv_make_anon() to remove it from the named nodes list. This path inlines the list entry removal into bdrv_delete() and removes bdrv_make_anon(). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/block.c b/block.c
index 2a09403649..d129e60bf2 100644
--- a/block.c
+++ b/block.c
@@ -2242,16 +2242,6 @@ void bdrv_close_all(void)
}
}
-/* 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)
-{
- if (bs->node_name[0] != '\0') {
- QTAILQ_REMOVE(&graph_bdrv_states, bs, node_list);
- }
- bs->node_name[0] = '\0';
-}
-
/* Fields that need to stay with the top-level BDS */
static void bdrv_move_feature_fields(BlockDriverState *bs_dest,
BlockDriverState *bs_src)
@@ -2381,8 +2371,9 @@ static void bdrv_delete(BlockDriverState *bs)
bdrv_close(bs);
/* remove from list, if necessary */
- bdrv_make_anon(bs);
-
+ if (bs->node_name[0] != '\0') {
+ QTAILQ_REMOVE(&graph_bdrv_states, bs, node_list);
+ }
QTAILQ_REMOVE(&all_bdrv_states, bs, bs_list);
g_free(bs);