+++ /dev/null
-From 6517453d33b72863940749b1b4ee1b36b7acf24c Mon Sep 17 00:00:00 2001
-From: Wolfgang Bumiller <w.bumiller@proxmox.com>
-Date: Thu, 10 Dec 2015 15:14:00 +0100
-Subject: [PATCH 36/55] savevm-async: migration and bdrv_open update
-
----
- savevm-async.c | 25 ++++++++++++-------------
- 1 file changed, 12 insertions(+), 13 deletions(-)
-
-diff --git a/savevm-async.c b/savevm-async.c
-index 8117443..bb4372c 100644
---- a/savevm-async.c
-+++ b/savevm-async.c
-@@ -150,10 +150,10 @@ static int block_state_close(void *opaque)
- return bdrv_flush(snap_state.bs);
- }
-
--static int block_state_put_buffer(void *opaque, const uint8_t *buf,
-- int64_t pos, int size)
-+static ssize_t block_state_put_buffer(void *opaque, const uint8_t *buf,
-+ int64_t pos, size_t size)
- {
-- int ret;
-+ ssize_t ret;
-
- assert(pos == snap_state.bs_pos);
-
-@@ -197,12 +197,13 @@ static void process_savevm_co(void *opaque)
- }
-
- while (snap_state.state == SAVE_STATE_ACTIVE) {
-- uint64_t pending_size;
-+ uint64_t pending_size, pend_post, pend_nonpost;
-
-- pending_size = qemu_savevm_state_pending(snap_state.file, 0);
-+ qemu_savevm_state_pending(snap_state.file, 0, &pend_nonpost, &pend_post);
-+ pending_size = pend_post + pend_nonpost;
-
- if (pending_size) {
-- ret = qemu_savevm_state_iterate(snap_state.file);
-+ ret = qemu_savevm_state_iterate(snap_state.file, false);
- if (ret < 0) {
- save_snapshot_error("qemu_savevm_state_iterate error %d", ret);
- break;
-@@ -213,7 +214,7 @@ static void process_savevm_co(void *opaque)
- if (store_and_stop())
- break;
- DPRINTF("savevm inerate finished\n");
-- qemu_savevm_state_complete_precopy(snap_state.file);
-+ qemu_savevm_state_complete_precopy(snap_state.file, false);
- DPRINTF("save complete\n");
- save_snapshot_completed();
- break;
-@@ -246,7 +247,6 @@ static const QEMUFileOps block_file_ops = {
-
- void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)
- {
-- BlockDriver *drv = NULL;
- Error *local_err = NULL;
-
- int bdrv_oflags = BDRV_O_CACHE_WB | BDRV_O_RDWR;
-@@ -285,7 +285,7 @@ void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)
- QDict *options = NULL;
- options = qdict_new();
- qdict_put(options, "driver", qstring_from_str("raw"));
-- ret = bdrv_open(&snap_state.bs, statefile, NULL, options, bdrv_oflags, drv, &local_err);
-+ ret = bdrv_open(&snap_state.bs, statefile, NULL, options, bdrv_oflags, &local_err);
- if (ret < 0) {
- error_set(errp, ERROR_CLASS_GENERIC_ERROR, "failed to open '%s'", statefile);
- goto restart;
-@@ -450,8 +450,8 @@ void qmp_delete_drive_snapshot(const char *device, const char *name,
- }
- }
-
--static int loadstate_get_buffer(void *opaque, uint8_t *buf, int64_t pos,
-- int size)
-+static ssize_t loadstate_get_buffer(void *opaque, uint8_t *buf, int64_t pos,
-+ size_t size)
- {
- BlockDriverState *bs = (BlockDriverState *)opaque;
- int64_t maxlen = bdrv_getlength(bs);
-@@ -474,7 +474,6 @@ static const QEMUFileOps loadstate_file_ops = {
- int load_state_from_blockdev(const char *filename)
- {
- BlockDriverState *bs = NULL;
-- BlockDriver *drv = NULL;
- Error *local_err = NULL;
- Error *blocker = NULL;
-
-@@ -482,7 +481,7 @@ int load_state_from_blockdev(const char *filename)
- int ret;
-
- bs = bdrv_new();
-- ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_CACHE_WB, drv, &local_err);
-+ ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_CACHE_WB, &local_err);
- error_setg(&blocker, "block device is in use by load state");
- bdrv_op_block_all(bs, blocker);
-
---
-2.1.4
-