]> git.proxmox.com Git - qemu.git/blobdiff - block/qcow2.c
block: Introduce bdrv_writev_vmstate
[qemu.git] / block / qcow2.c
index 1d180732e9a3e952b5fbcf7d10bdc4acffec0d4c..1d856af80fb8507ae960d516d3d2b7ee4f15b896 100644 (file)
@@ -1652,18 +1652,24 @@ static void dump_refcounts(BlockDriverState *bs)
 }
 #endif
 
-static int qcow2_save_vmstate(BlockDriverState *bs, const uint8_t *buf,
-                              int64_t pos, int size)
+static int qcow2_save_vmstate(BlockDriverState *bs, QEMUIOVector *qiov,
+                              int64_t pos)
 {
     BDRVQcowState *s = bs->opaque;
     int growable = bs->growable;
     int ret;
+    void *buf;
+
+    buf = qemu_blockalign(bs, qiov->size);
+    qemu_iovec_to_buf(qiov, 0, buf, qiov->size);
 
     BLKDBG_EVENT(bs->file, BLKDBG_VMSTATE_SAVE);
     bs->growable = 1;
-    ret = bdrv_pwrite(bs, qcow2_vm_state_offset(s) + pos, buf, size);
+    ret = bdrv_pwrite(bs, qcow2_vm_state_offset(s) + pos, buf, qiov->size);
     bs->growable = growable;
 
+    qemu_vfree(buf);
+
     return ret;
 }