On 09/11/2015 03:56, Fam Zheng wrote:
> +    if (bs->drv && bs->drv->bdrv_drain) {
> +        bs->drv->bdrv_drain(bs);
> +    }
> +    QLIST_FOREACH(child, &bs->children, next) {
> +        BlockDriverState *cbs = child->bs;
> +        if (cbs->drv && cbs->drv->bdrv_drain) {
> +            cbs->drv->bdrv_drain(bs);
> +        }
> +    }

I think this is not enough, because the children could have children as
well.

Perhaps you can do it like bdrv_flush: one function does the call to
bdrv_drain and the recursion on children; bdrv_drain calls that one
function and then does the "while (busy)" loop.

Paolo

Reply via email to