adding 2.5 pve patches and left-over extra fixes
[pve-qemu-kvm.git] / debian / patches / pve / 0021-backup-vma-run-flush-inside-coroutine.patch
bloba62c3e38ec82a7f8c64a960a9ac398bff4dfb626
1 From fe57d97e87fd49b03ce11d381f88fed546ea674d 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 21/41] backup: vma: run flush inside coroutine
6 ---
7 blockdev.c | 10 +++++++++-
8 vma-writer.c | 4 ++++
9 2 files changed, 13 insertions(+), 1 deletion(-)
11 diff --git a/blockdev.c b/blockdev.c
12 index c36888d..8df70cb 100644
13 --- a/blockdev.c
14 +++ b/blockdev.c
15 @@ -2980,6 +2980,13 @@ static void pvebackup_cleanup(void)
19 +static void coroutine_fn backup_close_vma_stream(void *opaque)
21 + PVEBackupDevInfo *di = opaque;
23 + vma_writer_close_stream(backup_state.vmaw, di->dev_id);
26 static void pvebackup_complete_cb(void *opaque, int ret)
28 PVEBackupDevInfo *di = opaque;
29 @@ -2997,7 +3004,8 @@ static void pvebackup_complete_cb(void *opaque, int ret)
30 di->target = NULL;
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);
35 + qemu_coroutine_enter(co, di);
38 block_job_cb(bs, ret);
39 diff --git a/vma-writer.c b/vma-writer.c
40 index 2558fe1..3c77e98 100644
41 --- a/vma-writer.c
42 +++ b/vma-writer.c
43 @@ -706,6 +706,10 @@ int vma_writer_close(VmaWriter *vmaw, Error **errp)
45 int i;
47 + while (vmaw->co_writer) {
48 + aio_poll(qemu_get_aio_context(), true);
49 + }
51 assert(vmaw->co_writer == NULL);
53 if (vmaw->cmd) {
54 --
55 2.1.4