[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/29] blockdev: Rename blk_backends
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 09/29] blockdev: Rename blk_backends |
Date: |
Thu, 17 Mar 2016 16:56:22 +0100 |
From: Max Reitz <address@hidden>
The blk_backends list does not contain all BlockBackends but only the
ones which are referenced by the monitor, and that is not necessarily
true for every BlockBackend. Rename the list to monitor_block_backends
to make that fact clear.
Signed-off-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/block-backend.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/block/block-backend.c b/block/block-backend.c
index e75b8fe..3bb2a6a 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -29,7 +29,7 @@ struct BlockBackend {
int refcnt;
BlockDriverState *bs;
DriveInfo *legacy_dinfo; /* null unless created by drive_new() */
- QTAILQ_ENTRY(BlockBackend) link; /* for blk_backends */
+ QTAILQ_ENTRY(BlockBackend) monitor_link; /* for monitor_block_backends */
void *dev; /* attached device model, if any */
/* TODO change to DeviceState when all users are qdevified */
@@ -69,9 +69,10 @@ static const AIOCBInfo block_backend_aiocb_info = {
static void drive_info_del(DriveInfo *dinfo);
-/* All the BlockBackends (except for hidden ones) */
-static QTAILQ_HEAD(, BlockBackend) blk_backends =
- QTAILQ_HEAD_INITIALIZER(blk_backends);
+/* All BlockBackends referenced by the monitor and which are iterated through
by
+ * blk_next() */
+static QTAILQ_HEAD(, BlockBackend) monitor_block_backends =
+ QTAILQ_HEAD_INITIALIZER(monitor_block_backends);
/*
* Create a new BlockBackend with @name, with a reference count of one.
@@ -105,7 +106,7 @@ BlockBackend *blk_new(const char *name, Error **errp)
blk->refcnt = 1;
notifier_list_init(&blk->remove_bs_notifiers);
notifier_list_init(&blk->insert_bs_notifiers);
- QTAILQ_INSERT_TAIL(&blk_backends, blk, link);
+ QTAILQ_INSERT_TAIL(&monitor_block_backends, blk, monitor_link);
return blk;
}
@@ -178,7 +179,7 @@ static void blk_delete(BlockBackend *blk)
}
/* Avoid double-remove after blk_hide_on_behalf_of_hmp_drive_del() */
if (blk->name[0]) {
- QTAILQ_REMOVE(&blk_backends, blk, link);
+ QTAILQ_REMOVE(&monitor_block_backends, blk, monitor_link);
}
g_free(blk->name);
drive_info_del(blk->legacy_dinfo);
@@ -241,7 +242,7 @@ void blk_remove_all_bs(void)
}
/*
- * Return the BlockBackend after @blk.
+ * Return the monitor-owned BlockBackend after @blk.
* If @blk is null, return the first one.
* Else, return @blk's next sibling, which may be null.
*
@@ -252,7 +253,8 @@ void blk_remove_all_bs(void)
*/
BlockBackend *blk_next(BlockBackend *blk)
{
- return blk ? QTAILQ_NEXT(blk, link) : QTAILQ_FIRST(&blk_backends);
+ return blk ? QTAILQ_NEXT(blk, monitor_link)
+ : QTAILQ_FIRST(&monitor_block_backends);
}
/*
@@ -353,7 +355,7 @@ BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo)
*/
void blk_hide_on_behalf_of_hmp_drive_del(BlockBackend *blk)
{
- QTAILQ_REMOVE(&blk_backends, blk, link);
+ QTAILQ_REMOVE(&monitor_block_backends, blk, monitor_link);
blk->name[0] = 0;
if (blk->bs) {
bdrv_make_anon(blk->bs);
--
1.8.3.1
- [Qemu-devel] [PULL 00/29] Block patches, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 03/29] monitor: Use BB list for BB name completion, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 01/29] block: Fix qemu_root_bds_opts.head initialisation, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 05/29] block: Add blk_commit_all(), Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 02/29] block: Fix memory leak in hmp_drive_add_node(), Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 04/29] block: Use blk_next() in block-backend.c, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 07/29] qapi: Drop QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 09/29] blockdev: Rename blk_backends,
Kevin Wolf <=
- [Qemu-devel] [PULL 08/29] block: Drop BB name from bad option error, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 06/29] block: Use blk_{commit, flush}_all() consistently, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 10/29] blockdev: Add list of all BlockBackends, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 11/29] blockdev: Separate BB name management, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 16/29] block: Add blk_next_root_bs(), Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 13/29] blockdev: Remove blk_hide_on_behalf_of_hmp_drive_del(), Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 15/29] block: Add bdrv_next_monitor_owned(), Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 17/29] block: Rewrite bdrv_next(), Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 14/29] block: Move some bdrv_*_all() functions to BB, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 12/29] blockdev: Split monitor reference from BB creation, Kevin Wolf, 2016/03/17