From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v2 8/8] block: Remove bdrv_states
Date: Tue, 10 Nov 2015 04:27:49 +0100 [thread overview]
Message-ID: <1447126069-6185-9-git-send-email-mreitz@redhat.com> (raw)
In-Reply-To: <1447126069-6185-1-git-send-email-mreitz@redhat.com>
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 <mreitz@redhat.com>
---
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 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);
@@ -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
next prev parent reply other threads:[~2015-11-10 3:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-10 3:27 [Qemu-devel] [PATCH v2 0/8] blockdev: Further BlockBackend work Max Reitz
2015-11-10 3:27 ` [Qemu-devel] [PATCH v2 1/8] block: Add blk_name_taken() Max Reitz
2015-11-10 3:27 ` [Qemu-devel] [PATCH v2 2/8] block: Add blk_next_inserted() Max Reitz
2015-11-11 15:33 ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2015-11-10 3:27 ` [Qemu-devel] [PATCH v2 3/8] block: Add blk_commit_all() and blk_invalidate_cache_all() Max Reitz
2015-11-10 3:27 ` [Qemu-devel] [PATCH v2 4/8] block: Use BlockBackend more Max Reitz
2015-11-10 3:27 ` [Qemu-devel] [PATCH v2 5/8] blockdev: Add list of monitor-owned BlockBackends Max Reitz
2015-11-10 3:27 ` [Qemu-devel] [PATCH v2 6/8] blockdev: Remove blk_hide_on_behalf_of_hmp_drive_del() Max Reitz
2015-11-10 3:27 ` [Qemu-devel] [PATCH v2 7/8] block: Move some bdrv_*_all() functions to BB Max Reitz
2015-12-01 16:01 ` Kevin Wolf
2015-12-04 23:15 ` Max Reitz
2015-12-07 11:16 ` Kevin Wolf
2015-11-10 3:27 ` Max Reitz [this message]
2015-11-25 13:50 ` [Qemu-devel] [PATCH v2 8/8] block: Remove bdrv_states Kevin Wolf
2015-11-10 3:45 ` [Qemu-devel] [PATCH v2 0/8] blockdev: Further BlockBackend work Eric Blake
2015-11-10 3:49 ` Max Reitz
2015-11-10 3:58 ` Jeff Cody
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447126069-6185-9-git-send-email-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).