[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 13/19] block/copy-before-write: use write-unchanged in fleecin
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v3 13/19] block/copy-before-write: use write-unchanged in fleecing mode |
Date: |
Wed, 22 Dec 2021 18:40:12 +0100 |
As announced in previous commit, we need use write-unchanged operations
for fleecing, so that fleecing client may unshare writes if needed.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
block/copy-before-write.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/block/copy-before-write.c b/block/copy-before-write.c
index f95c54dbdf..ca0d7fa5ff 100644
--- a/block/copy-before-write.c
+++ b/block/copy-before-write.c
@@ -133,6 +133,8 @@ static void cbw_child_perm(BlockDriverState *bs, BdrvChild
*c,
uint64_t perm, uint64_t shared,
uint64_t *nperm, uint64_t *nshared)
{
+ BDRVCopyBeforeWriteState *s = bs->opaque;
+
if (!(role & BDRV_CHILD_FILTERED)) {
/*
* Target child
@@ -143,7 +145,7 @@ static void cbw_child_perm(BlockDriverState *bs, BdrvChild
*c,
* only upfront.
*/
*nshared = BLK_PERM_ALL & ~BLK_PERM_RESIZE;
- *nperm = BLK_PERM_WRITE;
+ *nperm = s->fleecing ? BLK_PERM_WRITE_UNCHANGED : BLK_PERM_WRITE;
} else {
/* Source child */
bdrv_default_perms(bs, c, role, reopen_queue,
@@ -213,7 +215,14 @@ static int cbw_open(BlockDriverState *bs, QDict *options,
int flags,
((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, bitmap, false, errp);
+ /*
+ * For fleecing scheme set parameter write_unchanged=true, as our
+ * copy-before-write operations will actually be write-unchanged. As well
we
+ * take write-unchanged permission instead of write, which is important for
+ * backup with immutable_source=true to work as fleecing client.
+ */
+ s->bcs = block_copy_state_new(bs->file, s->target, bitmap,
+ is_fleecing_drv(unfiltered_target), errp);
if (!s->bcs) {
error_prepend(errp, "Cannot create block-copy-state: ");
return -EINVAL;
--
2.31.1
- [PATCH v3 01/19] block/block-copy: move copy_bitmap initialization to block_copy_state_new(), (continued)
- [PATCH v3 01/19] block/block-copy: move copy_bitmap initialization to block_copy_state_new(), Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 08/19] block/reqlist: add reqlist_wait_all(), Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 02/19] block/dirty-bitmap: bdrv_merge_dirty_bitmap(): add return value, Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 04/19] block/copy-before-write: add bitmap open parameter, Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 03/19] block/block-copy: block_copy_state_new(): add bitmap parameter, Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 05/19] block/block-copy: add block_copy_reset(), Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 12/19] block/block-copy: add write-unchanged mode, Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 10/19] block: introduce fleecing block driver, Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 06/19] block: intoduce reqlist, Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 11/19] block/copy-before-write: support fleecing block driver, Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 13/19] block/copy-before-write: use write-unchanged in fleecing mode,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v3 09/19] block: introduce FleecingState class, Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 14/19] iotests/image-fleecing: add test-case for fleecing format node, Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 15/19] iotests.py: add qemu_io_pipe_and_status(), Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 16/19] iotests/image-fleecing: add test case with bitmap, Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 17/19] block: blk_root(): return non-const pointer, Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 19/19] iotests/image-fleecing: test push backup with fleecing, Vladimir Sementsov-Ogievskiy, 2021/12/22
- [PATCH v3 18/19] qapi: backup: add immutable-source parameter, Vladimir Sementsov-Ogievskiy, 2021/12/22