[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v5 07/38] block: Make bdrv_is_inserted() recursi
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-block] [PATCH v5 07/38] block: Make bdrv_is_inserted() recursive |
Date: |
Tue, 29 Sep 2015 11:15:49 +0200 |
User-agent: |
Notmuch/0.13.2 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) |
On Fri 18 Sep 2015 05:22:42 PM CEST, Max Reitz wrote:
> 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 | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/block.c b/block.c
> index 4a089e6..c4fa299 100644
> --- a/block.c
> +++ b/block.c
> @@ -3247,14 +3247,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);
> }
If there's drv->bdrv_is_inserted then this code stops here and does not
iterate the children, is this correct?
> - return drv->bdrv_is_inserted(bs);
> + QLIST_FOREACH(child, &bs->children, next) {
> + if (!bdrv_is_inserted(child->bs)) {
> + return false;
> + }
> + }
> + return true;
> }
Berto
- Re: [Qemu-block] [PATCH v5 07/38] block: Make bdrv_is_inserted() recursive,
Alberto Garcia <=