qemu/block.c
/*
 * Takes the staged changes for the reopen from bdrv_reopen_prepare(), and
 * makes them final by swapping the staging BlockDriverState contents into
 * the active BlockDriverState contents.
 */
Takes the staged changes for the reopen from bdrv_reopen_prepare(), and
makes them final by swapping the staging BlockDriverState contents into
the active BlockDriverState contents.
Takes the staged changes for the reopen from bdrv_reopen_prepare () and makes them final by swapping the staging BlockDriverState contents into the active BlockDriverState contents .
void bdrv_reopen_commit(BDRVReopenState *reopen_state)
{
    BlockDriver *drv;
    BlockDriverState *bs;
    BdrvChild *child;
    bool old_can_write, new_can_write;
    assert(reopen_state != NULL);
    bs = reopen_state->bs;
    drv = bs->drv;
    assert(drv != NULL);
    old_can_write =
        !bdrv_is_read_only(bs) && !(bdrv_get_flags(bs) & BDRV_O_INACTIVE);
    if (drv->bdrv_reopen_commit) {
        drv->bdrv_reopen_commit(reopen_state);
    }
    qobject_unref(bs->explicit_options);
    qobject_unref(bs->options);
    bs->explicit_options   = reopen_state->explicit_options;
    bs->options            = reopen_state->options;
    bs->open_flags         = reopen_state->flags;
    bs->read_only = !(reopen_state->flags & BDRV_O_RDWR);
    bs->detect_zeroes      = reopen_state->detect_zeroes;
    QLIST_FOREACH(child, &bs->children, next) {
        qdict_del(bs->explicit_options, child->name);
        qdict_del(bs->options, child->name);
    }
    bdrv_refresh_limits(bs, NULL);
    bdrv_set_perm(reopen_state->bs, reopen_state->perm,
                  reopen_state->shared_perm);
    new_can_write =
        !bdrv_is_read_only(bs) && !(bdrv_get_flags(bs) & BDRV_O_INACTIVE);
    if (!old_can_write && new_can_write && drv->bdrv_reopen_bitmaps_rw) {
        Error *local_err = NULL;
        if (drv->bdrv_reopen_bitmaps_rw(bs, &local_err) < 0) {
            error_reportf_err(local_err,
                              "%s: Failed to make dirty bitmaps writable: ",
                              bdrv_get_node_name(bs));
        }
    }
}
void bdrv_reopen_commit ( BDRVReopenState * reopen_state ) { BlockDriver * drv ; BlockDriverState * bs ; BdrvChild * child ; bool old_can_write , new_can_write ; assert ( reopen_state != NULL ) ; bs = reopen_state -> bs ; drv = bs -> drv ; assert ( drv != NULL ) ; old_can_write = ! bdrv_is_read_only ( bs ) && ! ( bdrv_get_flags ( bs ) & BDRV_O_INACTIVE ) ; if ( drv -> bdrv_reopen_commit ) { drv -> bdrv_reopen_commit ( reopen_state ) ; } qobject_unref ( bs -> explicit_options ) ; qobject_unref ( bs -> options ) ; bs -> explicit_options = reopen_state -> explicit_options ; bs -> options = reopen_state -> options ; bs -> open_flags = reopen_state -> flags ; bs -> read_only = ! ( reopen_state -> flags & BDRV_O_RDWR ) ; bs -> detect_zeroes = reopen_state -> detect_zeroes ; QLIST_FOREACH ( child , & bs -> children , next ) { qdict_del ( bs -> explicit_options , child -> name ) ; qdict_del ( bs -> options , child -> name ) ; } bdrv_refresh_limits ( bs , NULL ) ; bdrv_set_perm ( reopen_state -> bs , reopen_state -> perm , reopen_state -> shared_perm ) ; new_can_write = ! bdrv_is_read_only ( bs ) && ! ( bdrv_get_flags ( bs ) & BDRV_O_INACTIVE ) ; if ( ! old_can_write && new_can_write && drv -> bdrv_reopen_bitmaps_rw ) { Error * local_err = NULL ; if ( drv -> bdrv_reopen_bitmaps_rw ( bs , & local_err ) < 0 ) { error_reportf_err ( local_err , " " , bdrv_get_node_name ( bs ) ) ; } } }
Takes the staged changes for the reopen from bdrv_reopen_prepare(), and
 makes them final by swapping the staging BlockDriverState contents into
 the active BlockDriverState contents.
Takes the staged changes for the reopen from bdrv_reopen_prepare () and makes them final by swapping the staging BlockDriverState contents into the active BlockDriverState contents .
/* If there are any driver level actions to take */ /* set BDS specific flags now */ /* Remove child references from bs->options and bs->explicit_options.
     * Child options were already removed in bdrv_reopen_queue_child() */ /* This is not fatal, bitmaps just left read-only, so all following
             * writes will fail. User can remove read-only bitmaps to unblock
             * writes.
             */