[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/6] block/copy-before-write: require BLK_PERM_WRITE_UNCHANGED
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v2 2/6] block/copy-before-write: require BLK_PERM_WRITE_UNCHANGED for fleecing |
Date: |
Wed, 21 Jul 2021 17:04:20 +0300 |
Now block-copy detects fleecing scheme and do write-unchanged
operations if detected. So, let's require appropriate permissions.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
block/copy-before-write.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/block/copy-before-write.c b/block/copy-before-write.c
index 2cd68b480a..808e8707ed 100644
--- a/block/copy-before-write.c
+++ b/block/copy-before-write.c
@@ -113,6 +113,14 @@ static void cbw_refresh_filename(BlockDriverState *bs)
bs->file->bs->filename);
}
+static bool cbw_is_fleecing(BlockDriverState *bs)
+{
+ BDRVCopyBeforeWriteState *s = bs->opaque;
+
+ return bs->file && s->target &&
+ bdrv_skip_filters(bs) == bdrv_backing_chain_next(s->target->bs);
+}
+
static void cbw_child_perm(BlockDriverState *bs, BdrvChild *c,
BdrvChildRole role,
BlockReopenQueue *reopen_queue,
@@ -129,7 +137,8 @@ static void cbw_child_perm(BlockDriverState *bs, BdrvChild
*c,
* only upfront.
*/
*nshared = BLK_PERM_ALL & ~BLK_PERM_RESIZE;
- *nperm = BLK_PERM_WRITE;
+ *nperm =
+ cbw_is_fleecing(bs) ? BLK_PERM_WRITE_UNCHANGED : BLK_PERM_WRITE;
} else {
/* Source child */
bdrv_default_perms(bs, c, role, reopen_queue,
--
2.29.2
- [PATCH v2 for-6.2 0/6] push backup with fleecing, Vladimir Sementsov-Ogievskiy, 2021/07/21
- [PATCH v2 1/6] block/block-copy: use write-unchanged for fleecing scheme, Vladimir Sementsov-Ogievskiy, 2021/07/21
- [PATCH v2 2/6] block/copy-before-write: require BLK_PERM_WRITE_UNCHANGED for fleecing,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v2 3/6] block: share writes on backing child of fleecing node, Vladimir Sementsov-Ogievskiy, 2021/07/21
- [PATCH v2 4/6] block: blk_root(): return non-const pointer, Vladimir Sementsov-Ogievskiy, 2021/07/21
- [PATCH v2 5/6] qapi: backup: add immutable-source paramter, Vladimir Sementsov-Ogievskiy, 2021/07/21
- [PATCH v2 6/6] iotests/image-fleecing: test push backup with fleecing, Vladimir Sementsov-Ogievskiy, 2021/07/21