[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RESEND 07/50] block: Make bdrv_is_inserted() recursi
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH RESEND 07/50] block: Make bdrv_is_inserted() recursive |
Date: |
Tue, 27 Jan 2015 14:45:40 -0500 |
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>
---
block.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/block.c b/block.c
index 4a5f8fc..aff7682 100644
--- a/block.c
+++ b/block.c
@@ -5208,11 +5208,12 @@ int bdrv_is_inserted(BlockDriverState *bs)
{
BlockDriver *drv = bs->drv;
- if (!drv)
+ if (!drv) {
return 0;
- if (!drv->bdrv_is_inserted)
- return 1;
- 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.1.0
- [Qemu-devel] [PATCH RESEND 00/50] blockdev: BlockBackend and media, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 04/50] hw/usb-storage: Check whether BB is inserted, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 05/50] block: Fix BB AIOCB AioContext without BDS, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 06/50] block: Add blk_is_available(), Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 07/50] block: Make bdrv_is_inserted() recursive,
Max Reitz <=
- [Qemu-devel] [PATCH RESEND 02/50] iotests: Only create BB if necessary, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 08/50] block/quorum: Implement bdrv_is_inserted(), Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 11/50] block: Move BlockAcctStats into BlockBackend, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 12/50] block: Move I/O status and error actions into BB, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 09/50] block: Move guest_block_size into BlockBackend, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 18/50] block: Respect empty BB in bdrv_query_info(), Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 16/50] block: Prepare remaining BB functions for NULL BDS, Max Reitz, 2015/01/27