[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 30/36] block/backup: move write_flags calculation inside backup_jo
From: |
Max Reitz |
Subject: |
[PULL 30/36] block/backup: move write_flags calculation inside backup_job_create |
Date: |
Thu, 10 Oct 2019 13:42:54 +0200 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
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 <address@hidden>
Message-id: address@hidden
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
block/backup.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/block/backup.c b/block/backup.c
index d918836f1d..b5b7939356 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;
--
2.21.0
- [PULL 20/36] ide: account UNMAP (TRIM) operations, (continued)
- [PULL 20/36] ide: account UNMAP (TRIM) operations, Max Reitz, 2019/10/10
- [PULL 21/36] scsi: store unmap offset and nb_sectors in request struct, Max Reitz, 2019/10/10
- [PULL 22/36] scsi: move unmap error checking to the complete callback, Max Reitz, 2019/10/10
- [PULL 23/36] scsi: account unmap operations, Max Reitz, 2019/10/10
- [PULL 24/36] file-posix: account discard operations, Max Reitz, 2019/10/10
- [PULL 25/36] qapi: query-blockstat: add driver specific file-posix stats, Max Reitz, 2019/10/10
- [PULL 27/36] iotests: Disable 125 on broken XFS versions, Max Reitz, 2019/10/10
- [PULL 26/36] iotests: Fix 125 for growth_mode = metadata, Max Reitz, 2019/10/10
- [PULL 28/36] iotests: Use stat -c %b in 125, Max Reitz, 2019/10/10
- [PULL 29/36] block/backup: move in-flight requests handling from backup to block-copy, Max Reitz, 2019/10/10
- [PULL 30/36] block/backup: move write_flags calculation inside backup_job_create,
Max Reitz <=
- [PULL 31/36] block/block-copy: split block_copy_set_callbacks function, Max Reitz, 2019/10/10
- [PULL 34/36] nbd: add empty .bdrv_reopen_prepare, Max Reitz, 2019/10/10
- [PULL 32/36] block: introduce backup-top filter driver, Max Reitz, 2019/10/10
- [PULL 36/36] iotests/162: Fix for newer Linux 5.3+, Max Reitz, 2019/10/10
- [PULL 35/36] tests: fix I/O test for hosts defaulting to LUKSv2, Max Reitz, 2019/10/10
- [PULL 33/36] block/backup: use backup-top instead of write notifiers, Max Reitz, 2019/10/10
- Re: [PULL 00/36] Block patches, Peter Maydell, 2019/10/14