[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 06/38] block: Make bdrv_is_inserted() recursive
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v3 06/38] block: Make bdrv_is_inserted() recursive |
Date: |
Wed, 3 Jun 2015 21:43:47 +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>
---
block.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/block.c b/block.c
index fdb5612..d6479e6 100644
--- a/block.c
+++ b/block.c
@@ -2997,10 +2997,9 @@ bool bdrv_is_inserted(BlockDriverState *bs)
if (!drv) {
return false;
}
- if (!drv->bdrv_is_inserted) {
- return true;
- }
- return drv->bdrv_is_inserted(bs);
+ return (!drv->bdrv_is_inserted || drv->bdrv_is_inserted(bs)) &&
+ (!bs->file || bdrv_is_inserted(bs->file)) &&
+ (!bs->backing_hd || bdrv_is_inserted(bs->backing_hd));
}
/**
--
2.4.1
- [Qemu-devel] [PATCH v3 02/38] blockdev: Allow creation of BDS trees without BB, (continued)
- [Qemu-devel] [PATCH v3 02/38] blockdev: Allow creation of BDS trees without BB, Max Reitz, 2015/06/03
- [Qemu-devel] [PATCH v3 03/38] iotests: Only create BB if necessary, Max Reitz, 2015/06/03
- [Qemu-devel] [PATCH v3 05/38] block: Add blk_is_available(), Max Reitz, 2015/06/03
- [Qemu-devel] [PATCH v3 04/38] block: Make bdrv_is_inserted() return a bool, Max Reitz, 2015/06/03
- [Qemu-devel] [PATCH v3 06/38] block: Make bdrv_is_inserted() recursive,
Max Reitz <=
- [Qemu-devel] [PATCH v3 08/38] block: Invoke change media CB before NULLing drv, Max Reitz, 2015/06/03
- [Qemu-devel] [PATCH v3 07/38] block/quorum: Implement bdrv_is_inserted(), Max Reitz, 2015/06/03
- [Qemu-devel] [PATCH v3 10/38] hw/usb-storage: Check whether BB is inserted, Max Reitz, 2015/06/03