aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2019-10-01 16:14:06 +0300
committerMax Reitz <mreitz@redhat.com>2019-10-10 10:56:18 +0200
commit843670f30f35935cfd7781b6a49c258f22261b1d (patch)
treecc5ef59875b1a46b9b784dc5c2e123e43625ee81 /block
parenta6ffe1998cfe1fd3cd83de0a7d1dd16eb514f987 (diff)
downloadqemu-843670f30f35935cfd7781b6a49c258f22261b1d.zip
qemu-843670f30f35935cfd7781b6a49c258f22261b1d.tar.gz
qemu-843670f30f35935cfd7781b6a49c258f22261b1d.tar.bz2
block/backup: move write_flags calculation inside backup_job_create
This is logic-less refactoring, which simplifies further patch, as we'll need write_flags for backup-top filter creation and backup-top should be created before block job creation. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-id: 20191001131409.14202-3-vsementsov@virtuozzo.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/backup.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/block/backup.c b/block/backup.c
index d918836..b5b7939 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -446,20 +446,6 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
goto error;
}
- /* job->len is fixed, so we can't allow resize */
- job = block_job_create(job_id, &backup_job_driver, txn, bs, 0, BLK_PERM_ALL,
- speed, creation_flags, cb, opaque, errp);
- if (!job) {
- goto error;
- }
-
- job->source_bs = bs;
- job->on_source_error = on_source_error;
- job->on_target_error = on_target_error;
- job->sync_mode = sync_mode;
- job->sync_bitmap = sync_bitmap;
- job->bitmap_mode = bitmap_mode;
-
/*
* 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
@@ -477,6 +463,20 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
write_flags = (bdrv_chain_contains(target, bs) ? BDRV_REQ_SERIALISING : 0) |
(compress ? BDRV_REQ_WRITE_COMPRESSED : 0),
+ /* job->len is fixed, so we can't allow resize */
+ job = block_job_create(job_id, &backup_job_driver, txn, bs, 0, BLK_PERM_ALL,
+ speed, creation_flags, cb, opaque, errp);
+ if (!job) {
+ goto error;
+ }
+
+ job->source_bs = bs;
+ job->on_source_error = on_source_error;
+ job->on_target_error = on_target_error;
+ job->sync_mode = sync_mode;
+ job->sync_bitmap = sync_bitmap;
+ job->bitmap_mode = bitmap_mode;
+
job->bcs = block_copy_state_new(bs, target, cluster_size, write_flags,
backup_progress_bytes_callback,
backup_progress_reset_callback, job, errp);
@@ -485,11 +485,11 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
}
job->cluster_size = cluster_size;
+ job->len = len;
/* Required permissions are already taken by block-copy-state target */
block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL,
&error_abort);
- job->len = len;
return &job->common;