6838f03890
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
101 lines
4.3 KiB
Diff
101 lines
4.3 KiB
Diff
From 0000000000000000000000000000000000000000 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] 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 99e6bcc748..8c2967a8cb 100644
|
|
--- a/block/backup.c
|
|
+++ b/block/backup.c
|
|
@@ -539,6 +539,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;
|
|
@@ -663,6 +664,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 e41e293d2b..1b08b242eb 100644
|
|
--- a/block/replication.c
|
|
+++ b/block/replication.c
|
|
@@ -561,7 +561,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 56a6b24a0b..a9ed9034b5 100644
|
|
--- a/blockdev.c
|
|
+++ b/blockdev.c
|
|
@@ -3293,7 +3293,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);
|
|
@@ -3372,7 +3372,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 715c2c2680..c1b6b6a810 100644
|
|
--- a/blockjob.c
|
|
+++ b/blockjob.c
|
|
@@ -322,7 +322,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 a5482775ec..1dbbdafd31 100644
|
|
--- a/include/block/block_int.h
|
|
+++ b/include/block/block_int.h
|
|
@@ -985,6 +985,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
|
|
|