pve-qemu-qoup/debian/patches/pve/0026-backup-modify-job-api.patch
2017-09-08 09:44:31 +02:00

101 lines
4.3 KiB
Diff

From 6017af4918c9795a7f98a463426e1e21065b15d5 Mon Sep 17 00:00:00 2001
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
Date: Wed, 9 Dec 2015 15:04:57 +0100
Subject: [PATCH 26/28] backup: modify job api
Introduce a pause_count parameter to start a backup in
paused mode. This way backups of multiple drives can be
started up sequentially via the completion callback while
having been started at the same point in time.
---
block/backup.c | 2 ++
block/replication.c | 2 +-
blockdev.c | 4 ++--
blockjob.c | 2 +-
include/block/block_int.h | 1 +
5 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/block/backup.c b/block/backup.c
index a4fb2884f9..1ede70c061 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -558,6 +558,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
BlockdevOnError on_target_error,
int creation_flags,
BlockCompletionFunc *cb, void *opaque,
+ int pause_count,
BlockJobTxn *txn, Error **errp)
{
int64_t len;
@@ -682,6 +683,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL,
&error_abort);
job->common.len = len;
+ job->common.pause_count = pause_count;
block_job_txn_add_job(txn, &job->common);
return &job->common;
diff --git a/block/replication.c b/block/replication.c
index bf3c395eb4..1c41d9e6bf 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -531,7 +531,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
0, MIRROR_SYNC_MODE_NONE, NULL, false,
BLOCKDEV_ON_ERROR_REPORT,
BLOCKDEV_ON_ERROR_REPORT, BLOCK_JOB_INTERNAL,
- backup_job_completed, bs, NULL, &local_err);
+ backup_job_completed, bs, 0, NULL, &local_err);
if (local_err) {
error_propagate(errp, local_err);
backup_job_cleanup(bs);
diff --git a/blockdev.c b/blockdev.c
index e8a9a65167..9b6cfafd33 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3262,7 +3262,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, BlockJobTxn *txn,
job = backup_job_create(backup->job_id, bs, target_bs, backup->speed,
backup->sync, bmap, backup->compress,
backup->on_source_error, backup->on_target_error,
- BLOCK_JOB_DEFAULT, NULL, NULL, txn, &local_err);
+ BLOCK_JOB_DEFAULT, NULL, NULL, 0, txn, &local_err);
bdrv_unref(target_bs);
if (local_err != NULL) {
error_propagate(errp, local_err);
@@ -3341,7 +3341,7 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, BlockJobTxn *txn,
job = backup_job_create(backup->job_id, bs, target_bs, backup->speed,
backup->sync, NULL, backup->compress,
backup->on_source_error, backup->on_target_error,
- BLOCK_JOB_DEFAULT, NULL, NULL, txn, &local_err);
+ BLOCK_JOB_DEFAULT, NULL, NULL, 0, txn, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
}
diff --git a/blockjob.c b/blockjob.c
index 6e489327ff..764d41863e 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -289,7 +289,7 @@ void block_job_start(BlockJob *job)
job->co = qemu_coroutine_create(block_job_co_entry, job);
job->pause_count--;
job->busy = true;
- job->paused = false;
+ job->paused = job->pause_count > 0;
bdrv_coroutine_enter(blk_bs(job->blk), job->co);
}
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 89d7b458e7..19b84b027f 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -879,6 +879,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
BlockdevOnError on_target_error,
int creation_flags,
BlockCompletionFunc *cb, void *opaque,
+ int pause_count,
BlockJobTxn *txn, Error **errp);
void hmp_drive_add_node(Monitor *mon, const char *optstr);
--
2.11.0