From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQIGs-0007WC-KN for qemu-devel@nongnu.org; Tue, 24 Feb 2015 11:23:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQIGr-0006yO-IJ for qemu-devel@nongnu.org; Tue, 24 Feb 2015 11:23:42 -0500 From: Max Reitz Date: Tue, 24 Feb 2015 11:23:20 -0500 Message-Id: <1424795000-26494-10-git-send-email-mreitz@redhat.com> In-Reply-To: <1424795000-26494-1-git-send-email-mreitz@redhat.com> References: <1424795000-26494-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH 9/9] block: Remove bdrv_states List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: Kevin Wolf , Markus Armbruster , Stefan Hajnoczi , Max Reitz 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 --- 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