block: introduce bdrv_remove_file_or_backing_child()
To be used for reopen in future commit. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20210610120537.196183-2-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
7ec390d587
commit
5b9950193b
24
block.c
24
block.c
@ -4795,17 +4795,16 @@ static TransactionActionDrv bdrv_remove_filter_or_cow_child_drv = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A function to remove backing-chain child of @bs if exists: cow child for
|
* A function to remove backing or file child of @bs.
|
||||||
* format nodes (always .backing) and filter child for filters (may be .file or
|
|
||||||
* .backing)
|
|
||||||
*
|
|
||||||
* Function doesn't update permissions, caller is responsible for this.
|
* Function doesn't update permissions, caller is responsible for this.
|
||||||
*/
|
*/
|
||||||
static void bdrv_remove_filter_or_cow_child(BlockDriverState *bs,
|
static void bdrv_remove_file_or_backing_child(BlockDriverState *bs,
|
||||||
Transaction *tran)
|
BdrvChild *child,
|
||||||
|
Transaction *tran)
|
||||||
{
|
{
|
||||||
BdrvRemoveFilterOrCowChild *s;
|
BdrvRemoveFilterOrCowChild *s;
|
||||||
BdrvChild *child = bdrv_filter_or_cow_child(bs);
|
|
||||||
|
assert(child == bs->backing || child == bs->file);
|
||||||
|
|
||||||
if (!child) {
|
if (!child) {
|
||||||
return;
|
return;
|
||||||
@ -4830,6 +4829,17 @@ static void bdrv_remove_filter_or_cow_child(BlockDriverState *bs,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A function to remove backing-chain child of @bs if exists: cow child for
|
||||||
|
* format nodes (always .backing) and filter child for filters (may be .file or
|
||||||
|
* .backing)
|
||||||
|
*/
|
||||||
|
static void bdrv_remove_filter_or_cow_child(BlockDriverState *bs,
|
||||||
|
Transaction *tran)
|
||||||
|
{
|
||||||
|
bdrv_remove_file_or_backing_child(bs, bdrv_filter_or_cow_child(bs), tran);
|
||||||
|
}
|
||||||
|
|
||||||
static int bdrv_replace_node_noperm(BlockDriverState *from,
|
static int bdrv_replace_node_noperm(BlockDriverState *from,
|
||||||
BlockDriverState *to,
|
BlockDriverState *to,
|
||||||
bool auto_skip, Transaction *tran,
|
bool auto_skip, Transaction *tran,
|
||||||
|
Loading…
Reference in New Issue
Block a user