aboutsummaryrefslogtreecommitdiff
path: root/block/snapshot.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2015-11-19 09:42:10 +0300
committerJuan Quintela <quintela@redhat.com>2015-11-19 11:50:00 +0100
commit7cb14481498e7acd969a76b53be0535cd90f7d53 (patch)
tree53e94877d1e4dae89962a5199694c03255603629 /block/snapshot.c
parent0b46160521ab72744da94988583a45d4d45e2986 (diff)
migration: implement bdrv_all_find_vmstate_bs helper
The patch also ensures proper locking for the operation. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'block/snapshot.c')
-rw-r--r--block/snapshot.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/block/snapshot.c b/block/snapshot.c
index 75d0b968f6..6e9fa8da98 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -469,3 +469,18 @@ int bdrv_all_create_snapshot(QEMUSnapshotInfo *sn,
*first_bad_bs = bs;
return err;
}
+
+BlockDriverState *bdrv_all_find_vmstate_bs(void)
+{
+ bool not_found = true;
+ BlockDriverState *bs = NULL;
+
+ while (not_found && (bs = bdrv_next(bs))) {
+ AioContext *ctx = bdrv_get_aio_context(bs);
+
+ aio_context_acquire(ctx);
+ not_found = !bdrv_can_snapshot(bs);
+ aio_context_release(ctx);
+ }
+ return bs;
+}