From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKtEn-0004YV-Dg for qemu-devel@nongnu.org; Mon, 09 Feb 2015 13:39:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKtEi-0005fT-L9 for qemu-devel@nongnu.org; Mon, 09 Feb 2015 13:39:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKtEi-0005en-EU for qemu-devel@nongnu.org; Mon, 09 Feb 2015 13:39:08 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t19Id6vt022363 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 9 Feb 2015 13:39:07 -0500 From: Max Reitz Date: Mon, 9 Feb 2015 13:38:41 -0500 Message-Id: <1423507124-29809-20-git-send-email-mreitz@redhat.com> In-Reply-To: <1423507124-29809-1-git-send-email-mreitz@redhat.com> References: <1423507124-29809-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v2 19/22] block: Remove bdrv_states List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , 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 94eb4e0..cbe333d 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) @@ -1982,17 +1976,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); } @@ -2033,8 +2016,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 2df5bc5..84a90b6 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -361,7 +361,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 49d4fdd..2e9e3e3 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