[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 07/39] block: Make bdrv_is_inserted() recursive
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v7 07/39] block: Make bdrv_is_inserted() recursive |
Date: |
Mon, 19 Oct 2015 17:53:13 +0200 |
If bdrv_is_inserted() is called on the top level BDS, it should make
sure all nodes in the BDS tree are actually inserted.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
---
block.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index 2a77169..0f23a98 100644
--- a/block.c
+++ b/block.c
@@ -3143,14 +3143,20 @@ void bdrv_invalidate_cache_all(Error **errp)
bool bdrv_is_inserted(BlockDriverState *bs)
{
BlockDriver *drv = bs->drv;
+ BdrvChild *child;
if (!drv) {
return false;
}
- if (!drv->bdrv_is_inserted) {
- return true;
+ if (drv->bdrv_is_inserted) {
+ return drv->bdrv_is_inserted(bs);
}
- return drv->bdrv_is_inserted(bs);
+ QLIST_FOREACH(child, &bs->children, next) {
+ if (!bdrv_is_inserted(child->bs)) {
+ return false;
+ }
+ }
+ return true;
}
/**
--
2.6.1
- [Qemu-devel] [PATCH v7 00/39] blockdev: BlockBackend and media, Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 02/39] block: Set BDRV_O_INCOMING in bdrv_fill_options(), Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 01/39] block: Remove host floppy support, Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 03/39] blockdev: Allow creation of BDS trees without BB, Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 04/39] iotests: Only create BB if necessary, Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 05/39] block: Make bdrv_is_inserted() return a bool, Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 07/39] block: Make bdrv_is_inserted() recursive,
Max Reitz <=
- [Qemu-devel] [PATCH v7 06/39] block: Add blk_is_available(), Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 09/39] block: Invoke change media CB before NULLing drv, Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 08/39] block/raw_bsd: Drop raw_is_inserted(), Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 10/39] hw/block/fdc: Implement tray status, Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 11/39] hw/usb-storage: Check whether BB is inserted, Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 12/39] block: Fix BB AIOCB AioContext without BDS, Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 14/39] block: Remove wr_highest_sector from BlockAcctStats, Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 13/39] block: Move guest_block_size into BlockBackend, Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 15/39] block: Move BlockAcctStats into BlockBackend, Max Reitz, 2015/10/19
- [Qemu-devel] [PATCH v7 17/39] block/throttle-groups: Make incref/decref public, Max Reitz, 2015/10/19