]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/pve/0063-PVE-Backup-allow-passing-max-workers-performance-set.patch
update submodule and patches to 7.2.0
[pve-qemu.git] / debian / patches / pve / 0063-PVE-Backup-allow-passing-max-workers-performance-set.patch
CommitLineData
ed012365
WB
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Fiona Ebner <f.ebner@proxmox.com>
3Date: Mon, 3 Oct 2022 15:52:04 +0200
4Subject: [PATCH] PVE Backup: allow passing max-workers performance setting
5
6For query-proxmox-support, add an indication that it's possible to use
7the setting.
8
9For now, the other two BackupPerf settings are not exposed:
10
11* use-copy-range: would need to be implemented by the backup-dump
12block driver first, and in fact, the default for backup was changed,
13because it wasn't as fast for backup in QEMU, see commit
146a30f663d4c0b3c45a544d541e0c4e214b2473a1.
15
16* max-chunk: enforced to be at least the backup cluster size, which is
174 MiB for PBS and otherwise maximum of source and target cluster size.
18And block-copy has a maximum buffer size of 1 MiB, so setting a larger
19max-chunk doesn't even have an effect. To make the setting sensibly
20usable the check would need to be removed and optionally the
21block-copy max buffer size would need to be bumped. I tried doing just
22that, and tested different source/target combinations with different
23max-chunk settings, but there were no noticable improvements over the
24default "unlimited" (resulting in 1 MiB for block-copy).
25
26Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
27---
28 block/monitor/block-hmp-cmds.c | 4 +++-
29 pve-backup.c | 18 +++++++++++++-----
30 qapi/block-core.json | 9 +++++++--
31 3 files changed, 23 insertions(+), 8 deletions(-)
32
33diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
d03e1b3c 34index 57b2457f1e..ab0c988ae9 100644
ed012365
WB
35--- a/block/monitor/block-hmp-cmds.c
36+++ b/block/monitor/block-hmp-cmds.c
37@@ -1049,7 +1049,9 @@ void coroutine_fn hmp_backup(Monitor *mon, const QDict *qdict)
38 false, false, // PBS encrypt
39 true, dir ? BACKUP_FORMAT_DIR : BACKUP_FORMAT_VMA,
40 false, NULL, false, NULL, !!devlist,
41- devlist, qdict_haskey(qdict, "speed"), speed, &error);
42+ devlist, qdict_haskey(qdict, "speed"), speed,
43+ false, 0, // BackupPerf max-workers
44+ &error);
45
46 hmp_handle_error(mon, error);
47 }
48diff --git a/pve-backup.c b/pve-backup.c
d03e1b3c 49index 4067018dbe..3ca4f74cb8 100644
ed012365
WB
50--- a/pve-backup.c
51+++ b/pve-backup.c
52@@ -55,6 +55,7 @@ static struct PVEBackupState {
53 bool starting;
54 } stat;
55 int64_t speed;
56+ BackupPerf perf;
57 VmaWriter *vmaw;
58 ProxmoxBackupHandle *pbs;
59 GList *di_list;
d03e1b3c 60@@ -490,8 +491,6 @@ static void create_backup_jobs_bh(void *opaque) {
ed012365
WB
61 }
62 backup_state.txn = job_txn_new_seq();
63
64- BackupPerf perf = { .max_workers = 16 };
65-
66 /* create and start all jobs (paused state) */
67 GList *l = backup_state.di_list;
68 while (l) {
d03e1b3c 69@@ -511,8 +510,9 @@ static void create_backup_jobs_bh(void *opaque) {
ed012365
WB
70
71 BlockJob *job = backup_job_create(
72 NULL, di->bs, di->target, backup_state.speed, sync_mode, di->bitmap,
73- bitmap_mode, false, NULL, &perf, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
74- JOB_DEFAULT, pvebackup_complete_cb, di, backup_state.txn, &local_err);
75+ bitmap_mode, false, NULL, &backup_state.perf, BLOCKDEV_ON_ERROR_REPORT,
76+ BLOCKDEV_ON_ERROR_REPORT, JOB_DEFAULT, pvebackup_complete_cb, di, backup_state.txn,
77+ &local_err);
78
d03e1b3c
FE
79 aio_context_release(aio_context);
80
81@@ -583,7 +583,9 @@ UuidInfo coroutine_fn *qmp_backup(
ed012365
WB
82 bool has_config_file, const char *config_file,
83 bool has_firewall_file, const char *firewall_file,
84 bool has_devlist, const char *devlist,
85- bool has_speed, int64_t speed, Error **errp)
86+ bool has_speed, int64_t speed,
87+ bool has_max_workers, int64_t max_workers,
88+ Error **errp)
89 {
90 assert(qemu_in_coroutine());
91
d03e1b3c 92@@ -913,6 +915,11 @@ UuidInfo coroutine_fn *qmp_backup(
ed012365
WB
93
94 backup_state.speed = (has_speed && speed > 0) ? speed : 0;
95
96+ backup_state.perf = (BackupPerf){ .max_workers = 16 };
97+ if (has_max_workers) {
98+ backup_state.perf.max_workers = max_workers;
99+ }
100+
101 backup_state.vmaw = vmaw;
102 backup_state.pbs = pbs;
103
d03e1b3c 104@@ -1088,5 +1095,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
ed012365
WB
105 ret->pbs_dirty_bitmap_migration = true;
106 ret->query_bitmap_info = true;
107 ret->pbs_masterkey = true;
108+ ret->backup_max_workers = true;
109 return ret;
110 }
111diff --git a/qapi/block-core.json b/qapi/block-core.json
d03e1b3c 112index 889726fc26..65795b7204 100644
ed012365
WB
113--- a/qapi/block-core.json
114+++ b/qapi/block-core.json
5b15e2ec 115@@ -829,6 +829,8 @@
ed012365
WB
116 #
117 # @encrypt: use encryption ((optional for format 'pbs', defaults to true if there is a keyfile)
118 #
119+# @max-workers: see @BackupPerf for details. Default 16.
120+#
121 # Returns: the uuid of the backup job
122 #
123 ##
5b15e2ec 124@@ -847,7 +849,9 @@
ed012365
WB
125 '*format': 'BackupFormat',
126 '*config-file': 'str',
127 '*firewall-file': 'str',
128- '*devlist': 'str', '*speed': 'int' },
129+ '*devlist': 'str',
130+ '*speed': 'int',
131+ '*max-workers': 'int' },
132 'returns': 'UuidInfo', 'coroutine': true }
133
134 ##
5b15e2ec 135@@ -902,7 +906,8 @@
ed012365
WB
136 'pbs-dirty-bitmap-savevm': 'bool',
137 'pbs-dirty-bitmap-migration': 'bool',
138 'pbs-masterkey': 'bool',
139- 'pbs-library-version': 'str' } }
140+ 'pbs-library-version': 'str',
141+ 'backup-max-workers': 'bool' } }
142
143 ##
144 # @query-proxmox-support: