From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v4 17/17] block: Remove bdrv_states list
Date: Wed, 16 Mar 2016 19:54:45 +0100 [thread overview]
Message-ID: <1458154485-32536-18-git-send-email-mreitz@redhat.com> (raw)
In-Reply-To: <1458154485-32536-1-git-send-email-mreitz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 31 +++----------------------------
blockdev.c | 7 -------
include/block/block.h | 1 -
include/block/block_int.h | 4 ----
4 files changed, 3 insertions(+), 40 deletions(-)
diff --git a/block.c b/block.c
index 5d848fb..c47f99d 100644
--- a/block.c
+++ b/block.c
@@ -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);
}
}
diff --git a/blockdev.c b/blockdev.c
index a5df7e7..85dee57 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2426,11 +2426,6 @@ void qmp_x_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) {
- bdrv_device_remove(bs);
- }
-
blk_remove_bs(blk);
if (!blk_dev_has_tray(blk)) {
@@ -2478,8 +2473,6 @@ static void qmp_blockdev_insert_anon_medium(const char *device,
blk_insert_bs(blk, bs);
- QTAILQ_INSERT_TAIL(&bdrv_states, bs, device_list);
-
if (!blk_dev_has_tray(blk)) {
/* For tray-less devices, blockdev-close-tray is a no-op (or may not be
* called at all); therefore, the medium needs to be pushed into the
diff --git a/include/block/block.h b/include/block/block.h
index 09272c3..ea8ed04 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -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_device_remove(BlockDriverState *bs);
void bdrv_make_anon(BlockDriverState *bs);
void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top);
void bdrv_replace_in_backing_chain(BlockDriverState *old,
diff --git a/include/block/block_int.h b/include/block/block_int.h
index dda5ba0..bbf617a 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -442,8 +442,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 */
@@ -501,8 +499,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.7.3
next prev parent reply other threads:[~2016-03-16 18:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-16 18:54 [Qemu-devel] [PATCH v4 00/17] blockdev: Further BlockBackend work Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 01/17] monitor: Use BB list for BB name completion Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 02/17] block: Use blk_next() in block-backend.c Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 03/17] block: Add blk_commit_all() Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 04/17] block: Use blk_{commit, flush}_all() consistently Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 05/17] qapi: Drop QERR_UNKNOWN_BLOCK_FORMAT_FEATURE Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 06/17] block: Drop BB name from bad option error Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 07/17] blockdev: Rename blk_backends Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 08/17] blockdev: Add list of all BlockBackends Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 09/17] blockdev: Separate BB name management Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 10/17] blockdev: Split monitor reference from BB creation Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 11/17] blockdev: Remove blk_hide_on_behalf_of_hmp_drive_del() Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 12/17] block: Move some bdrv_*_all() functions to BB Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 13/17] block: Add bdrv_next_monitor_owned() Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 14/17] block: Add blk_next_root_bs() Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 15/17] block: Rewrite bdrv_next() Max Reitz
2016-03-16 18:54 ` [Qemu-devel] [PATCH v4 16/17] block: Use bdrv_next() instead of bdrv_states Max Reitz
2016-03-16 18:54 ` Max Reitz [this message]
2016-03-17 13:44 ` [Qemu-devel] [PATCH v4 00/17] blockdev: Further BlockBackend work Kevin Wolf
2016-03-23 19:06 ` Max Reitz
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=1458154485-32536-18-git-send-email-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=armbru@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).