]> git.proxmox.com Git - pve-qemu.git/blob - debian/patches/pve/0019-PVE-backup-modify-job-api.patch
bump version to 4.2.0-2
[pve-qemu.git] / debian / patches / pve / 0019-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: Tue, 10 Mar 2020 12:55:16 +0100
4 Subject: [PATCH 19/32] 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 cf62b1a38c..c155081de2 100644
22 --- a/block/backup.c
23 +++ b/block/backup.c
24 @@ -347,6 +347,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 @@ -468,6 +469,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 99532ce521..ec8de7b427 100644
43 --- a/block/replication.c
44 +++ b/block/replication.c
45 @@ -546,7 +546,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 8e029e9c01..c7fa663ebf 100644
56 --- a/blockdev.c
57 +++ b/blockdev.c
58 @@ -3583,7 +3583,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 dd033d0b37..b0d5eb9485 100644
70 --- a/include/block/block_int.h
71 +++ b/include/block/block_int.h
72 @@ -1215,6 +1215,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 void hmp_drive_add_node(Monitor *mon, const char *optstr);
80 diff --git a/job.c b/job.c
81 index 04409b40aa..7554f735e3 100644
82 --- a/job.c
83 +++ b/job.c
84 @@ -888,7 +888,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 }