void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp)

{

    BdrvChild *child;

    Error *local_err = NULL;

    int ret;



    if (!bs->drv)  {

        return;

    }



    if (!(bs->open_flags & BDRV_O_INACTIVE)) {

        return;

    }

    bs->open_flags &= ~BDRV_O_INACTIVE;



    if (bs->drv->bdrv_invalidate_cache) {

        bs->drv->bdrv_invalidate_cache(bs, &local_err);

        if (local_err) {

            bs->open_flags |= BDRV_O_INACTIVE;

            error_propagate(errp, local_err);

            return;

        }

    }



    QLIST_FOREACH(child, &bs->children, next) {

        bdrv_invalidate_cache(child->bs, &local_err);

        if (local_err) {

            bs->open_flags |= BDRV_O_INACTIVE;

            error_propagate(errp, local_err);

            return;

        }

    }



    ret = refresh_total_sectors(bs, bs->total_sectors);

    if (ret < 0) {

        bs->open_flags |= BDRV_O_INACTIVE;

        error_setg_errno(errp, -ret, "Could not refresh total sector count");

        return;

    }

}

void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp)

{

    BdrvChild *child;

    Error *local_err = NULL;

    int ret;



    if (!bs->drv)  {

        return;

    }



    if (!(bs->open_flags & BDRV_O_INACTIVE)) {

        return;

    }

    bs->open_flags &= ~BDRV_O_INACTIVE;



    if (bs->drv->bdrv_invalidate_cache) {

        bs->drv->bdrv_invalidate_cache(bs, &local_err);

        if (local_err) {

            bs->open_flags |= BDRV_O_INACTIVE;

            error_propagate(errp, local_err);

            return;

        }

    }



    QLIST_FOREACH(child, &bs->children, next) {

        bdrv_invalidate_cache(child->bs, &local_err);

        if (local_err) {

            bs->open_flags |= BDRV_O_INACTIVE;

            error_propagate(errp, local_err);

            return;

        }

    }



    ret = refresh_total_sectors(bs, bs->total_sectors);

    if (ret < 0) {

        bs->open_flags |= BDRV_O_INACTIVE;

        error_setg_errno(errp, -ret, "Could not refresh total sector count");

        return;

    }

}

    bs->open_flags &= ~BDRV_O_INACTIVE;     if (bs->drv->bdrv_invalidate_cache) {         bs->drv->bdrv_invalidate_cache(bs, &local_err);             bs->open_flags |= BDRV_O_INACTIVE;     QLIST_FOREACH(child, &bs->children, next) {         bdrv_invalidate_cache(child->bs, &local_err);
void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1)

{

    BdrvChild *child;

    Error *local_err = NULL;

    int VAR_2;



    if (!VAR_0->drv)  {

        return;

    }



    if (!(VAR_0->open_flags & BDRV_O_INACTIVE)) {

        return;

    }

    VAR_0->open_flags &= ~BDRV_O_INACTIVE;



    if (VAR_0->drv->FUNC_0) {

        VAR_0->drv->FUNC_0(VAR_0, &local_err);

        if (local_err) {

            VAR_0->open_flags |= BDRV_O_INACTIVE;

            error_propagate(VAR_1, local_err);

            return;

        }

    }



    QLIST_FOREACH(child, &VAR_0->children, next) {

        FUNC_0(child->VAR_0, &local_err);

        if (local_err) {

            VAR_0->open_flags |= BDRV_O_INACTIVE;

            error_propagate(VAR_1, local_err);

            return;

        }

    }



    VAR_2 = refresh_total_sectors(VAR_0, VAR_0->total_sectors);

    if (VAR_2 < 0) {

        VAR_0->open_flags |= BDRV_O_INACTIVE;

        error_setg_errno(VAR_1, -VAR_2, "Could not refresh total sector count");

        return;

    }

}

void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1)
{ BdrvChild *child; Error *local_err = NULL; int VAR_2; if (!VAR_0->drv)  { return; } if (!(VAR_0->open_flags & BDRV_O_INACTIVE)) { return; } VAR_0->open_flags &= ~BDRV_O_INACTIVE; if (VAR_0->drv->FUNC_0) { VAR_0->drv->FUNC_0(VAR_0, &local_err); if (local_err) { VAR_0->open_flags |= BDRV_O_INACTIVE; error_propagate(VAR_1, local_err); return; } } QLIST_FOREACH(child, &VAR_0->children, next) { FUNC_0(child->VAR_0, &local_err); if (local_err) { VAR_0->open_flags |= BDRV_O_INACTIVE; error_propagate(VAR_1, local_err); return; } } VAR_2 = refresh_total_sectors(VAR_0, VAR_0->total_sectors); if (VAR_2 < 0) { VAR_0->open_flags |= BDRV_O_INACTIVE; error_setg_errno(VAR_1, -VAR_2, "Could not refresh total sector count"); return; } }