[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 17/33] block/copy-before-write: cbw_init(): use file child aft
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v2 17/33] block/copy-before-write: cbw_init(): use file child after attaching |
Date: |
Thu, 20 May 2021 17:21:49 +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 v2 28/33] iotests: move 222 to tests/image-fleecing, (continued)
- [PATCH v2 28/33] iotests: move 222 to tests/image-fleecing, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 14/33] block/copy-before-write: bdrv_cbw_append(): replace child at last, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 15/33] block/copy-before-write: introduce cbw_init(), Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 16/33] block/copy-before-write: cbw_init(): rename variables, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 25/33] iotests.py: VM: add own __enter__ method, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 18/33] block/copy-before-write: cbw_init(): use options, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 27/33] iotests/222: constantly use single quotes for strings, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 17/33] block/copy-before-write: cbw_init(): use file child after attaching,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v2 26/33] iotests/222: fix pylint and mypy complains, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 22/33] qapi: publish copy-before-write filter, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 19/33] block/copy-before-write: initialize block-copy bitmap, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 20/33] block/block-copy: make setting progress optional, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 24/33] python/qemu/machine: QEMUMachine: improve qmp() method, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 21/33] block/copy-before-write: make public block driver, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 29/33] iotests.py: hmp_qemu_io: support qdev, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 30/33] iotests/image-fleecing: proper source device, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 31/33] iotests/image-fleecing: rename tgt_node, Vladimir Sementsov-Ogievskiy, 2021/05/20