]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/pve/0039-PVE-backup-rename-incremental-to-use-dirty-bitmap.patch
Fix dirty-bitmap PBS backup with multiple drives
[pve-qemu.git] / debian / patches / pve / 0039-PVE-backup-rename-incremental-to-use-dirty-bitmap.patch
CommitLineData
3ab149cc
TL
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Thomas Lamprecht <t.lamprecht@proxmox.com>
3Date: Mon, 6 Jul 2020 20:05:16 +0200
4Subject: [PATCH] PVE backup: rename incremental to use-dirty-bitmap
5
6Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
f257cc05 7Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3ab149cc 8---
f257cc05 9 pve-backup.c | 22 +++++++++++-----------
3ab149cc 10 qapi/block-core.json | 6 +++---
f257cc05 11 2 files changed, 14 insertions(+), 14 deletions(-)
3ab149cc
TL
12
13diff --git a/pve-backup.c b/pve-backup.c
f257cc05 14index 7b5558e28e..9e767d724c 100644
3ab149cc
TL
15--- a/pve-backup.c
16+++ b/pve-backup.c
17@@ -557,8 +557,8 @@ typedef struct QmpBackupTask {
18 const char *fingerprint;
19 bool has_fingerprint;
20 int64_t backup_time;
21- bool has_incremental;
22- bool incremental;
23+ bool has_use_dirty_bitmap;
24+ bool use_dirty_bitmap;
25 bool has_format;
26 BackupFormat format;
27 bool has_config_file;
28@@ -692,7 +692,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
29 int dump_cb_block_size = PROXMOX_BACKUP_DEFAULT_CHUNK_SIZE; // Hardcoded (4M)
30 firewall_name = "fw.conf";
31
32- bool incremental = task->has_incremental && task->incremental;
33+ bool use_dirty_bitmap = task->has_use_dirty_bitmap && task->use_dirty_bitmap;
34
35 char *pbs_err = NULL;
36 pbs = proxmox_backup_new(
f257cc05
SR
37@@ -726,9 +726,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
38 const char *devname = bdrv_get_device_name(di->bs);
3ab149cc
TL
39
40 BdrvDirtyBitmap *bitmap = bdrv_find_dirty_bitmap(di->bs, PBS_BITMAP_NAME);
f257cc05 41+ bool expect_only_dirty = false;
3ab149cc
TL
42
43- bool use_incremental = false;
44- if (incremental) {
45+ if (use_dirty_bitmap) {
46 if (bitmap == NULL) {
47 bitmap = bdrv_create_dirty_bitmap(di->bs, dump_cb_block_size, PBS_BITMAP_NAME, task->errp);
48 if (!bitmap) {
f257cc05 49@@ -738,7 +738,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
3ab149cc
TL
50 bdrv_set_dirty_bitmap(bitmap, 0, di->size);
51 dirty += di->size;
52 } else {
53- use_incremental = true;
f257cc05 54+ expect_only_dirty = true;
3ab149cc
TL
55 dirty += bdrv_get_dirty_count(bitmap);
56 }
57 di->bitmap = bitmap;
f257cc05 58@@ -747,7 +747,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
3ab149cc
TL
59 bdrv_release_dirty_bitmap(bitmap);
60 }
61
62- int dev_id = proxmox_backup_co_register_image(pbs, devname, di->size, use_incremental, task->errp);
f257cc05 63+ int dev_id = proxmox_backup_co_register_image(pbs, devname, di->size, expect_only_dirty, task->errp);
3ab149cc
TL
64 if (dev_id < 0) {
65 goto err;
66 }
f257cc05 67@@ -865,7 +865,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
3ab149cc
TL
68 backup_state.stat.dirty = dirty;
69 backup_state.stat.transferred = 0;
70 backup_state.stat.zero_bytes = 0;
71- backup_state.stat.reused = dirty >= total ? 0 : total - dirty;
72+ backup_state.stat.reused = format == BACKUP_FORMAT_PBS && dirty >= total ? 0 : total - dirty;
73
74 qemu_mutex_unlock(&backup_state.stat.lock);
75
f257cc05 76@@ -934,7 +934,7 @@ UuidInfo *qmp_backup(
3ab149cc
TL
77 bool has_fingerprint, const char *fingerprint,
78 bool has_backup_id, const char *backup_id,
79 bool has_backup_time, int64_t backup_time,
80- bool has_incremental, bool incremental,
81+ bool has_use_dirty_bitmap, bool use_dirty_bitmap,
82 bool has_format, BackupFormat format,
83 bool has_config_file, const char *config_file,
84 bool has_firewall_file, const char *firewall_file,
f257cc05 85@@ -953,8 +953,8 @@ UuidInfo *qmp_backup(
3ab149cc
TL
86 .backup_id = backup_id,
87 .has_backup_time = has_backup_time,
88 .backup_time = backup_time,
89- .has_incremental = has_incremental,
90- .incremental = incremental,
91+ .has_use_dirty_bitmap = has_use_dirty_bitmap,
92+ .use_dirty_bitmap = use_dirty_bitmap,
93 .has_format = has_format,
94 .format = format,
95 .has_config_file = has_config_file,
96diff --git a/qapi/block-core.json b/qapi/block-core.json
97index 8ffff7aaab..4fe3d6f751 100644
98--- a/qapi/block-core.json
99+++ b/qapi/block-core.json
100@@ -757,7 +757,7 @@
101 #
102 # @total: total amount of bytes involved in the backup process
103 #
104-# @dirty: with incremental mode, this is the amount of bytes involved
105+# @dirty: with incremental mode (PBS) this is the amount of bytes involved
106 # in the backup process which are marked dirty.
107 #
108 # @transferred: amount of bytes already backed up.
109@@ -820,7 +820,7 @@
110 #
111 # @backup-time: backup timestamp (Unix epoch, required for format 'pbs')
112 #
113-# @incremental: sync incremental changes since last job (optional for format 'pbs')
114+# @use-dirty-bitmap: use dirty bitmap to detect incremental changes since last job (optional for format 'pbs')
115 #
116 # Returns: the uuid of the backup job
117 #
118@@ -832,7 +832,7 @@
119 '*fingerprint': 'str',
120 '*backup-id': 'str',
121 '*backup-time': 'int',
122- '*incremental': 'bool',
123+ '*use-dirty-bitmap': 'bool',
124 '*format': 'BackupFormat',
125 '*config-file': 'str',
126 '*firewall-file': 'str',