[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 16/34] block/copy-before-write: cbw_init(): use file child aft
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v8 16/34] block/copy-before-write: cbw_init(): use file child after attaching |
Date: |
Tue, 24 Aug 2021 11:38:38 +0300 |
In the next commit we'll get rid of source argument of cbw_init().
Prepare to it now, to make next commit simpler: move the code block
that uses source below attaching the child and use bs->file->bs instead
of source variable.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
---
block/copy-before-write.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/block/copy-before-write.c b/block/copy-before-write.c
index d7f1833efa..4858dcf8ff 100644
--- a/block/copy-before-write.c
+++ b/block/copy-before-write.c
@@ -149,13 +149,6 @@ static int cbw_init(BlockDriverState *bs, BlockDriverState
*source,
{
BDRVCopyBeforeWriteState *s = bs->opaque;
- bs->total_sectors = source->total_sectors;
- bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED |
- (BDRV_REQ_FUA & source->supported_write_flags);
- bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
- ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) &
- source->supported_zero_flags);
-
bdrv_ref(target);
s->target = bdrv_attach_child(bs, target, "target", &child_of_bds,
BDRV_CHILD_DATA, errp);
@@ -173,6 +166,13 @@ static int cbw_init(BlockDriverState *bs, BlockDriverState
*source,
return -EINVAL;
}
+ bs->total_sectors = bs->file->bs->total_sectors;
+ bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED |
+ (BDRV_REQ_FUA & bs->file->bs->supported_write_flags);
+ bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
+ ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) &
+ bs->file->bs->supported_zero_flags);
+
s->bcs = block_copy_state_new(bs->file, s->target, false, compress, errp);
if (!s->bcs) {
error_prepend(errp, "Cannot create block-copy-state: ");
--
2.29.2
- [PATCH v8 07/34] block/block-copy: introduce block_copy_set_copy_opts(), (continued)
- [PATCH v8 07/34] block/block-copy: introduce block_copy_set_copy_opts(), Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 03/34] qdev-properties: PropertyInfo: add realized_set_allowed field, Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 13/34] block/copy-before-write: bdrv_cbw_append(): replace child at last, Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 04/34] qdev: allow setting drive property for realized device, Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 09/34] block/backup: move cluster size calculation to block-copy, Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 05/34] block: rename backup-top to copy-before-write, Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 11/34] block/copy-before-write: drop extra bdrv_unref on failure path, Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 15/34] block/copy-before-write: cbw_init(): rename variables, Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 14/34] block/copy-before-write: introduce cbw_init(), Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 16/34] block/copy-before-write: cbw_init(): use file child after attaching,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v8 01/34] block: introduce bdrv_replace_child_bs(), Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 18/34] block/copy-before-write: cbw_init(): use options, Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 19/34] block/copy-before-write: initialize block-copy bitmap, Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 10/34] block/copy-before-write: relax permission requirements when no parents, Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 26/34] iotests/222: fix pylint and mypy complains, Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 17/34] block/copy-before-write: bdrv_cbw_append(): drop unused compress arg, Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 21/34] block/copy-before-write: make public block driver, Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 23/34] python/qemu/machine.py: refactor _qemu_args(), Vladimir Sementsov-Ogievskiy, 2021/08/24
- [PATCH v8 25/34] python:QEMUMachine: template typing for self returning methods, Vladimir Sementsov-Ogievskiy, 2021/08/24