]> git.proxmox.com Git - pve-qemu.git/blob - debian/patches/pve/0027-PVE-Backup-modify-job-api.patch
import QEMU 5.0.0-rc2 and rebase patches
[pve-qemu.git] / debian / patches / pve / 0027-PVE-Backup-modify-job-api.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 Date: Mon, 6 Apr 2020 12:16:56 +0200
4 Subject: [PATCH] PVE-Backup: modify job api
5
6 Introduce a pause_count parameter to start a backup in
7 paused mode. This way backups of multiple drives can be
8 started up sequentially via the completion callback while
9 having been started at the same point in time.
10
11 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 ---
13 block/backup.c | 3 +++
14 block/replication.c | 2 +-
15 blockdev.c | 3 ++-
16 include/block/block_int.h | 1 +
17 job.c | 2 +-
18 5 files changed, 8 insertions(+), 3 deletions(-)
19
20 diff --git a/block/backup.c b/block/backup.c
21 index a7a7dcaf4c..ecd93e91e0 100644
22 --- a/block/backup.c
23 +++ b/block/backup.c
24 @@ -338,6 +338,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
25 BlockdevOnError on_target_error,
26 int creation_flags,
27 BlockCompletionFunc *cb, void *opaque,
28 + int pause_count,
29 JobTxn *txn, Error **errp)
30 {
31 int64_t len;
32 @@ -459,6 +460,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
33 block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL,
34 &error_abort);
35
36 + job->common.job.pause_count += pause_count;
37 +
38 return &job->common;
39
40 error:
41 diff --git a/block/replication.c b/block/replication.c
42 index da013c2041..17246a822c 100644
43 --- a/block/replication.c
44 +++ b/block/replication.c
45 @@ -554,7 +554,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
46 0, MIRROR_SYNC_MODE_NONE, NULL, 0, false, NULL,
47 BLOCKDEV_ON_ERROR_REPORT,
48 BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL,
49 - backup_job_completed, bs, NULL, &local_err);
50 + backup_job_completed, bs, 0, NULL, &local_err);
51 if (local_err) {
52 error_propagate(errp, local_err);
53 backup_job_cleanup(bs);
54 diff --git a/blockdev.c b/blockdev.c
55 index 5faddaa705..65c358e4ef 100644
56 --- a/blockdev.c
57 +++ b/blockdev.c
58 @@ -3114,7 +3114,8 @@ static BlockJob *do_backup_common(BackupCommon *backup,
59 backup->filter_node_name,
60 backup->on_source_error,
61 backup->on_target_error,
62 - job_flags, NULL, NULL, txn, errp);
63 + job_flags, NULL, NULL, 0, txn, errp);
64 +
65 return job;
66 }
67
68 diff --git a/include/block/block_int.h b/include/block/block_int.h
69 index 4c3587ea19..336f71e69d 100644
70 --- a/include/block/block_int.h
71 +++ b/include/block/block_int.h
72 @@ -1219,6 +1219,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
73 BlockdevOnError on_target_error,
74 int creation_flags,
75 BlockCompletionFunc *cb, void *opaque,
76 + int pause_count,
77 JobTxn *txn, Error **errp);
78
79 BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,
80 diff --git a/job.c b/job.c
81 index 53be57a3a0..e82253e041 100644
82 --- a/job.c
83 +++ b/job.c
84 @@ -918,7 +918,7 @@ void job_start(Job *job)
85 job->co = qemu_coroutine_create(job_co_entry, job);
86 job->pause_count--;
87 job->busy = true;
88 - job->paused = false;
89 + job->paused = job->pause_count > 0;
90 job_state_transition(job, JOB_STATUS_RUNNING);
91 aio_co_enter(job->aio_context, job->co);
92 }