diff options
Diffstat (limited to 'block/snapshot.c')
-rw-r--r-- | block/snapshot.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/block/snapshot.c b/block/snapshot.c index 61a6ad12dc..9f07a63e6d 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -403,3 +403,23 @@ int bdrv_all_delete_snapshot(const char *name, BlockDriverState **first_bad_bs, *first_bad_bs = bs; return ret; } + + +int bdrv_all_goto_snapshot(const char *name, BlockDriverState **first_bad_bs) +{ + int err = 0; + BlockDriverState *bs = NULL; + + while (err == 0 && (bs = bdrv_next(bs))) { + AioContext *ctx = bdrv_get_aio_context(bs); + + aio_context_acquire(ctx); + if (bdrv_can_snapshot(bs)) { + err = bdrv_snapshot_goto(bs, name); + } + aio_context_release(ctx); + } + + *first_bad_bs = bs; + return err; +} |