diff options
Diffstat (limited to 'block')
-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 9f07a63e6d..eae4730fc6 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -423,3 +423,23 @@ int bdrv_all_goto_snapshot(const char *name, BlockDriverState **first_bad_bs) *first_bad_bs = bs; return err; } + +int bdrv_all_find_snapshot(const char *name, BlockDriverState **first_bad_bs) +{ + QEMUSnapshotInfo sn; + 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_find(bs, &sn, name); + } + aio_context_release(ctx); + } + + *first_bad_bs = bs; + return err; +} |