From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFpKV-0006sc-Eh for qemu-devel@nongnu.org; Mon, 26 Jan 2015 14:28:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFpKU-0001o1-7P for qemu-devel@nongnu.org; Mon, 26 Jan 2015 14:28:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56629) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFpKU-0001np-0e for qemu-devel@nongnu.org; Mon, 26 Jan 2015 14:28:10 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0QJS81s012861 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 26 Jan 2015 14:28:09 -0500 From: Max Reitz Date: Mon, 26 Jan 2015 14:27:44 -0500 Message-Id: <1422300468-16216-18-git-send-email-mreitz@redhat.com> In-Reply-To: <1422300468-16216-1-git-send-email-mreitz@redhat.com> References: <1422300468-16216-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH 17/21] block: Remove bdrv_states List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 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 00fe705..64d1524 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); @@ -360,10 +357,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) @@ -1981,17 +1975,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); } @@ -2032,8 +2015,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; bs_dest->blk = bs_src->blk; memcpy(bs_dest->op_blockers, bs_src->op_blockers, diff --git a/include/block/block.h b/include/block/block.h index 1e1039f..217482f 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -357,7 +357,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 262b635..9005938 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -380,8 +380,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; QLIST_HEAD(, BdrvDirtyBitmap) dirty_bitmaps; int refcnt; -- 2.1.0