]> git.proxmox.com Git - pve-qemu-kvm.git/blob - debian/patches/pve/0020-backup-vma-run-flush-inside-coroutine.patch
7baafcc722a0cfb381a93ef3a2423382548e3457
[pve-qemu-kvm.git] / debian / patches / pve / 0020-backup-vma-run-flush-inside-coroutine.patch
1 From c0b66c21bb4d4cc1f02d4259d62dd8d6d413fd7f Mon Sep 17 00:00:00 2001
2 From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 Date: Wed, 9 Dec 2015 15:40:42 +0100
4 Subject: [PATCH 20/47] backup: vma: run flush inside coroutine
5
6 ---
7 blockdev.c | 10 +++++++++-
8 vma-writer.c | 4 ++++
9 2 files changed, 13 insertions(+), 1 deletion(-)
10
11 diff --git a/blockdev.c b/blockdev.c
12 index ef159b0..a9a900e 100644
13 --- a/blockdev.c
14 +++ b/blockdev.c
15 @@ -3087,6 +3087,13 @@ static void pvebackup_cleanup(void)
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;
29 @@ -3104,7 +3111,8 @@ static void pvebackup_complete_cb(void *opaque, int ret)
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);
39 diff --git a/vma-writer.c b/vma-writer.c
40 index ec8da53..216577a 100644
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 --
55 2.1.4
56