]> git.proxmox.com Git - pve-qemu.git/blob - debian/patches/pve/0035-backup_job_create-pass-cluster-size-for-dump.patch
Update and rebase to QEMU 4.1
[pve-qemu.git] / debian / patches / pve / 0035-backup_job_create-pass-cluster-size-for-dump.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Dietmar Maurer <dietmar@proxmox.com>
3 Date: Thu, 24 Oct 2019 08:06:50 +0200
4 Subject: [PATCH] backup_job_create: pass cluster size for dump
5
6 Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
7 ---
8 block/backup.c | 8 +++++++-
9 block/replication.c | 2 +-
10 blockdev.c | 10 ++++++----
11 include/block/block_int.h | 4 ++++
12 4 files changed, 18 insertions(+), 6 deletions(-)
13
14 diff --git a/block/backup.c b/block/backup.c
15 index 05569de5d4..a3f0d2c9a5 100644
16 --- a/block/backup.c
17 +++ b/block/backup.c
18 @@ -566,6 +566,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
19 BlockdevOnError on_target_error,
20 int creation_flags,
21 BackupDumpFunc *dump_cb,
22 + int dump_cb_block_size,
23 BlockCompletionFunc *cb, void *opaque,
24 int pause_count,
25 JobTxn *txn, Error **errp)
26 @@ -636,7 +637,12 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
27 goto error;
28 }
29
30 - cluster_size = backup_calculate_cluster_size(target ? target : bs, errp);
31 + if (target) {
32 + cluster_size = backup_calculate_cluster_size(target, errp);
33 + } else {
34 + cluster_size = dump_cb_block_size;
35 + }
36 +
37 if (cluster_size < 0) {
38 goto error;
39 }
40 diff --git a/block/replication.c b/block/replication.c
41 index f060755713..b9465c3587 100644
42 --- a/block/replication.c
43 +++ b/block/replication.c
44 @@ -546,7 +546,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
45 0, MIRROR_SYNC_MODE_NONE, NULL, false,
46 BLOCKDEV_ON_ERROR_REPORT,
47 BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL,
48 - NULL,
49 + NULL, 0,
50 backup_job_completed, bs, 0, NULL, &local_err);
51 if (local_err) {
52 error_propagate(errp, local_err);
53 diff --git a/blockdev.c b/blockdev.c
54 index 29196c18d8..a95beb823e 100644
55 --- a/blockdev.c
56 +++ b/blockdev.c
57 @@ -3544,6 +3544,7 @@ static void coroutine_fn pvebackup_co_start(void *opaque)
58 GList *l;
59 UuidInfo *uuid_info;
60 BlockJob *job;
61 + int dump_cb_block_size = -1;
62
63 if (!backup_state.backup_mutex_initialized) {
64 qemu_co_mutex_init(&backup_state.backup_mutex);
65 @@ -3631,6 +3632,7 @@ static void coroutine_fn pvebackup_co_start(void *opaque)
66 uuid_generate(uuid);
67
68 if (format == BACKUP_FORMAT_VMA) {
69 + dump_cb_block_size = VMA_CLUSTER_SIZE;
70 vmaw = vma_writer_create(task->backup_file, uuid, &local_err);
71 if (!vmaw) {
72 if (local_err) {
73 @@ -3738,8 +3740,8 @@ static void coroutine_fn pvebackup_co_start(void *opaque)
74 l = g_list_next(l);
75 job = backup_job_create(NULL, di->bs, di->target, backup_state.speed, MIRROR_SYNC_MODE_FULL, NULL,
76 false, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
77 - JOB_DEFAULT, pvebackup_co_dump_cb, pvebackup_complete_cb, di,
78 - 1, NULL, &local_err);
79 + JOB_DEFAULT, pvebackup_co_dump_cb, dump_cb_block_size,
80 + pvebackup_complete_cb, di, 1, NULL, &local_err);
81 if (!job || local_err != NULL) {
82 error_setg(&backup_state.error, "backup_job_create failed");
83 break;
84 @@ -4312,7 +4314,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
85 job = backup_job_create(backup->job_id, bs, target_bs, backup->speed,
86 backup->sync, bmap, backup->compress,
87 backup->on_source_error, backup->on_target_error,
88 - job_flags, NULL, NULL, NULL, 0, txn, &local_err);
89 + job_flags, NULL, 0, NULL, NULL, 0, txn, &local_err);
90 if (local_err != NULL) {
91 error_propagate(errp, local_err);
92 goto unref;
93 @@ -4417,7 +4419,7 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn,
94 job = backup_job_create(backup->job_id, bs, target_bs, backup->speed,
95 backup->sync, bmap, backup->compress,
96 backup->on_source_error, backup->on_target_error,
97 - job_flags, NULL, NULL, NULL, 0, txn, &local_err);
98 + job_flags, NULL, 0, NULL, NULL, 0, txn, &local_err);
99 if (local_err != NULL) {
100 error_propagate(errp, local_err);
101 }
102 diff --git a/include/block/block_int.h b/include/block/block_int.h
103 index 73a55a7351..13dfee215d 100644
104 --- a/include/block/block_int.h
105 +++ b/include/block/block_int.h
106 @@ -1156,6 +1156,9 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
107 * @on_target_error: The action to take upon error writing to the target.
108 * @creation_flags: Flags that control the behavior of the Job lifetime.
109 * See @BlockJobCreateFlags
110 + * @dump_cb: Callback for PVE backup code. Called for each data block when
111 + * target is NULL.
112 + * @dump_cb_block_size: The minimum block size expected by dump_cb.
113 * @cb: Completion function for the job.
114 * @opaque: Opaque pointer value passed to @cb.
115 * @txn: Transaction that this job is part of (may be NULL).
116 @@ -1172,6 +1175,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
117 BlockdevOnError on_target_error,
118 int creation_flags,
119 BackupDumpFunc *dump_cb,
120 + int dump_cb_block_size,
121 BlockCompletionFunc *cb, void *opaque,
122 int pause_count,
123 JobTxn *txn, Error **errp);