]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/pve/0020-backup-vma-run-flush-inside-coroutine.patch
add qemu-img dd stdin/stdout pipe patch
[pve-qemu.git] / debian / patches / pve / 0020-backup-vma-run-flush-inside-coroutine.patch
CommitLineData
f185a969 1From 7708c32e3a14860c519ab3540a50e24a314bb3fa Mon Sep 17 00:00:00 2001
95259824
WB
2From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3Date: Wed, 9 Dec 2015 15:40:42 +0100
45169293 4Subject: [PATCH 20/49] backup: vma: run flush inside coroutine
95259824
WB
5
6---
7 blockdev.c | 10 +++++++++-
8 vma-writer.c | 4 ++++
9 2 files changed, 13 insertions(+), 1 deletion(-)
10
11diff --git a/blockdev.c b/blockdev.c
076b4026 12index bad5b2a8b8..77ee7ff93b 100644
95259824
WB
13--- a/blockdev.c
14+++ b/blockdev.c
a544966d 15@@ -3087,6 +3087,13 @@ static void pvebackup_cleanup(void)
95259824
WB
16 }
17 }
18
19+static void coroutine_fn backup_close_vma_stream(void *opaque)
20+{
21+ PVEBackupDevInfo *di = opaque;
22+
23+ vma_writer_close_stream(backup_state.vmaw, di->dev_id);
24+}
25+
26 static void pvebackup_complete_cb(void *opaque, int ret)
27 {
28 PVEBackupDevInfo *di = opaque;
a544966d 29@@ -3104,7 +3111,8 @@ static void pvebackup_complete_cb(void *opaque, int ret)
95259824
WB
30 di->target = NULL;
31
32 if (backup_state.vmaw) {
33- vma_writer_close_stream(backup_state.vmaw, di->dev_id);
34+ Coroutine *co = qemu_coroutine_create(backup_close_vma_stream, di);
35+ qemu_coroutine_enter(co);
36 }
37
38 block_job_cb(bs, ret);
39diff --git a/vma-writer.c b/vma-writer.c
45169293 40index ec8da5378d..216577a4f7 100644
95259824
WB
41--- a/vma-writer.c
42+++ b/vma-writer.c
43@@ -700,6 +700,10 @@ int vma_writer_close(VmaWriter *vmaw, Error **errp)
44
45 int i;
46
47+ while (vmaw->co_writer) {
48+ aio_poll(qemu_get_aio_context(), true);
49+ }
50+
51 assert(vmaw->co_writer == NULL);
52
53 if (vmaw->cmd) {
54--
45169293 552.11.0
95259824 56