]> Git Repo - qemu.git/commitdiff
block: Remove bdrv_make_anon()
authorKevin Wolf <[email protected]>
Fri, 18 Mar 2016 09:46:57 +0000 (10:46 +0100)
committerKevin Wolf <[email protected]>
Wed, 30 Mar 2016 09:59:32 +0000 (11:59 +0200)
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 <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
block.c
blockdev.c
include/block/block.h

diff --git a/block.c b/block.c
index 2a09403649e89c779cae87c9986f16ca8125db9e..d129e60bf2e941b9fc30fed7e72bdb08e51146cf 100644 (file)
--- 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);
index 3eb05d1a90568081eace11cb2906d3ec69014e95..efb1107e80618df2d304bbc292109108b6c99057 100644 (file)
@@ -2869,9 +2869,6 @@ void hmp_drive_del(Monitor *mon, const QDict *qdict)
 
     /* Make the BlockBackend and the attached BlockDriverState anonymous */
     monitor_remove_blk(blk);
-    if (blk_bs(blk)) {
-        bdrv_make_anon(blk_bs(blk));
-    }
 
     /* If this BlockBackend has a device attached to it, its refcount will be
      * decremented when the device is removed; otherwise we have to do so here.
index 47e80bc2042144648ff14dacb8a04016a5f8a978..a48ad49397705c5192151d461f6b429ede54e7c3 100644 (file)
@@ -201,7 +201,6 @@ int bdrv_create(BlockDriver *drv, const char* filename,
 int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp);
 BlockDriverState *bdrv_new_root(void);
 BlockDriverState *bdrv_new(void);
-void bdrv_make_anon(BlockDriverState *bs);
 void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top);
 void bdrv_replace_in_backing_chain(BlockDriverState *old,
                                    BlockDriverState *new);
This page took 0.047264 seconds and 4 git commands to generate.