aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2021-01-17 00:46:52 +0300
committerMax Reitz <mreitz@redhat.com>2021-01-26 14:36:37 +0100
commit2c59fd833a6c547e174b26ba3e1f88f5865e16cf (patch)
treebac9d428e1078b7dbfb2e86415068cae5b1b9086 /block
parent3ee1483b95f314b960231c1c0b329bea4346f49c (diff)
downloadqemu-2c59fd833a6c547e174b26ba3e1f88f5865e16cf.zip
qemu-2c59fd833a6c547e174b26ba3e1f88f5865e16cf.tar.gz
qemu-2c59fd833a6c547e174b26ba3e1f88f5865e16cf.tar.bz2
qapi: backup: add max-chunk and max-workers to x-perf struct
Add new parameters to configure future backup features. The patch doesn't introduce aio backup requests (so we actually have only one worker) neither requests larger than one cluster. Still, formally we satisfy these maximums anyway, so add the parameters now, to facilitate further patch which will really change backup job behavior. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-Id: <20210116214705.822267-11-vsementsov@virtuozzo.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/backup.c28
-rw-r--r--block/replication.c2
2 files changed, 24 insertions, 6 deletions
diff --git a/block/backup.c b/block/backup.c
index 09ff5a9..5522c0f 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -388,6 +388,29 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
return NULL;
}
+ cluster_size = backup_calculate_cluster_size(target, errp);
+ if (cluster_size < 0) {
+ goto error;
+ }
+
+ if (perf->max_workers < 1) {
+ error_setg(errp, "max-workers must be greater than zero");
+ return NULL;
+ }
+
+ if (perf->max_chunk < 0) {
+ error_setg(errp, "max-chunk must be zero (which means no limit) or "
+ "positive");
+ return NULL;
+ }
+
+ if (perf->max_chunk && perf->max_chunk < cluster_size) {
+ error_setg(errp, "Required max-chunk (%" PRIi64 ") is less than backup "
+ "cluster size (%" PRIi64 ")", perf->max_chunk, cluster_size);
+ return NULL;
+ }
+
+
if (sync_bitmap) {
/* If we need to write to this bitmap, check that we can: */
if (bitmap_mode != BITMAP_SYNC_MODE_NEVER &&
@@ -420,11 +443,6 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
goto error;
}
- cluster_size = backup_calculate_cluster_size(target, errp);
- if (cluster_size < 0) {
- goto error;
- }
-
/*
* If source is in backing chain of target assume that target is going to be
* used for "image fleecing", i.e. it should represent a kind of snapshot of
diff --git a/block/replication.c b/block/replication.c
index 22ffc81..97be7ef 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -454,7 +454,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
int64_t active_length, hidden_length, disk_length;
AioContext *aio_context;
Error *local_err = NULL;
- BackupPerf perf = { .use_copy_range = true };
+ BackupPerf perf = { .use_copy_range = true, .max_workers = 1 };
aio_context = bdrv_get_aio_context(bs);
aio_context_acquire(aio_context);