qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH 9/9] block: Remove bdrv_states
Date: Tue, 24 Feb 2015 11:23:20 -0500	[thread overview]
Message-ID: <1424795000-26494-10-git-send-email-mreitz@redhat.com> (raw)
In-Reply-To: <1424795000-26494-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                   | 21 +--------------------
 include/block/block.h     |  1 -
 include/block/block_int.h |  2 --
 3 files changed, 1 insertion(+), 23 deletions(-)

diff --git a/block.c b/block.c
index dc24398..f0d22fe 100644
--- a/block.c
+++ b/block.c
@@ -88,9 +88,6 @@ static void coroutine_fn bdrv_co_do_rw(void *opaque);
 static int coroutine_fn bdrv_co_do_write_zeroes(BlockDriverState *bs,
     int64_t sector_num, int nb_sectors, BdrvRequestFlags flags);
 
-static QTAILQ_HEAD(, BlockDriverState) bdrv_states =
-    QTAILQ_HEAD_INITIALIZER(bdrv_states);
-
 static QTAILQ_HEAD(, BlockDriverState) graph_bdrv_states =
     QTAILQ_HEAD_INITIALIZER(graph_bdrv_states);
 
@@ -357,10 +354,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)
@@ -1999,17 +1993,6 @@ void bdrv_drain(BlockDriverState *bs)
    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);
     }
@@ -2050,8 +2033,6 @@ static void bdrv_move_feature_fields(BlockDriverState *bs_dest,
     /* job */
     bs_dest->job                = bs_src->job;
 
-    /* keep the same entry in bdrv_states */
-    bs_dest->device_list = bs_src->device_list;
     /* keep the same entry in the list of monitor-owned BDS */
     bs_dest->monitor_list = bs_src->monitor_list;
 
diff --git a/include/block/block.h b/include/block/block.h
index 95f86f0..698dc02 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -372,7 +372,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 d839a8a..8754b35 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -397,8 +397,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 monitor-owned BDS */
     QTAILQ_ENTRY(BlockDriverState) monitor_list;
     QLIST_HEAD(, BdrvDirtyBitmap) dirty_bitmaps;
-- 
2.1.0

      parent reply	other threads:[~2015-02-24 16:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24 16:23 [Qemu-devel] [PATCH 0/9] blockdev: Further BlockBackend work Max Reitz
2015-02-24 16:23 ` [Qemu-devel] [PATCH 1/9] block: Add blk_name_taken() Max Reitz
2015-02-24 16:23 ` [Qemu-devel] [PATCH 2/9] block: Add blk_next_inserted() Max Reitz
2015-02-24 16:23 ` [Qemu-devel] [PATCH 3/9] block: Add blk_commit_all() and blk_invalidate_cache_all() Max Reitz
2015-02-24 16:23 ` [Qemu-devel] [PATCH 4/9] block: Use BlockBackend more Max Reitz
2015-02-24 16:23 ` [Qemu-devel] [PATCH 5/9] blockdev: Add list of monitor-owned BlockBackends Max Reitz
2015-02-24 16:23 ` [Qemu-devel] [PATCH 6/9] blockdev: Remove blk_hide_on_behalf_of_do_drive_del() Max Reitz
2015-02-24 16:23 ` [Qemu-devel] [PATCH 7/9] block: Make bdrv_drain_one() public Max Reitz
2015-02-24 16:23 ` [Qemu-devel] [PATCH 8/9] block: Move some bdrv_*_all() functions to BB Max Reitz
2015-02-24 16:23 ` Max Reitz [this message]

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=1424795000-26494-10-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).