From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, vsementsov@virtuozzo.com,
wencongyang2@huawei.com, xiechanglong.d@gmail.com,
qemu-devel@nongnu.org, armbru@redhat.com, den@openvz.org,
mreitz@redhat.com, jsnow@redhat.com
Subject: [PATCH v15 2/5] block/backup: move write_flags calculation inside backup_job_create
Date: Tue, 1 Oct 2019 16:14:06 +0300 [thread overview]
Message-ID: <20191001131409.14202-3-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20191001131409.14202-1-vsementsov@virtuozzo.com>
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>
---
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
next prev parent reply other threads:[~2019-10-01 13:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-01 13:14 [PATCH v15 0/5] backup-top filter driver for backup Vladimir Sementsov-Ogievskiy
2019-10-01 13:14 ` [PATCH v15 1/5] block/backup: move in-flight requests handling from backup to block-copy Vladimir Sementsov-Ogievskiy
2019-10-02 18:09 ` Max Reitz
2019-10-01 13:14 ` Vladimir Sementsov-Ogievskiy [this message]
2019-10-02 18:35 ` [PATCH v15 2/5] block/backup: move write_flags calculation inside backup_job_create Max Reitz
2019-10-01 13:14 ` [PATCH v15 3/5] block/block-copy: split block_copy_set_callbacks function Vladimir Sementsov-Ogievskiy
2019-10-02 18:43 ` Max Reitz
2019-10-01 13:14 ` [PATCH v15 4/5] block: introduce backup-top filter driver Vladimir Sementsov-Ogievskiy
2019-10-04 13:37 ` Max Reitz
2019-10-01 13:14 ` [PATCH v15 5/5] block/backup: use backup-top instead of write notifiers Vladimir Sementsov-Ogievskiy
2019-10-04 14:19 ` Max Reitz
2019-10-04 14:21 ` [PATCH v15 0/5] backup-top filter driver for backup Max Reitz
2019-10-04 14:36 ` Vladimir Sementsov-Ogievskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191001131409.14202-3-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=den@openvz.org \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=wencongyang2@huawei.com \
--cc=xiechanglong.d@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).