mirror of https://github.com/proxmox/mirror_qemu
block: rename bdrv_replace_child to bdrv_replace_child_tran
We have bdrv_replace_child() wrapper on bdrv_replace_child_noperm(). But bdrv_replace_child() doesn't update permissions. It's rather strange, as normally it's expected that foo() should call foo_noperm() and update permissions. Let's rename and add comment. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-Id: <20210610112618.127378-2-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>master
parent
d5b2399458
commit
4bf021dbd5
14
block.c
14
block.c
|
@ -2249,12 +2249,14 @@ static TransactionActionDrv bdrv_replace_child_drv = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bdrv_replace_child
|
* bdrv_replace_child_tran
|
||||||
*
|
*
|
||||||
* Note: real unref of old_bs is done only on commit.
|
* Note: real unref of old_bs is done only on commit.
|
||||||
|
*
|
||||||
|
* The function doesn't update permissions, caller is responsible for this.
|
||||||
*/
|
*/
|
||||||
static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs,
|
static void bdrv_replace_child_tran(BdrvChild *child, BlockDriverState *new_bs,
|
||||||
Transaction *tran)
|
Transaction *tran)
|
||||||
{
|
{
|
||||||
BdrvReplaceChildState *s = g_new(BdrvReplaceChildState, 1);
|
BdrvReplaceChildState *s = g_new(BdrvReplaceChildState, 1);
|
||||||
*s = (BdrvReplaceChildState) {
|
*s = (BdrvReplaceChildState) {
|
||||||
|
@ -4766,7 +4768,7 @@ static void bdrv_remove_filter_or_cow_child_abort(void *opaque)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't have to restore child->bs here to undo bdrv_replace_child()
|
* We don't have to restore child->bs here to undo bdrv_replace_child_tran()
|
||||||
* because that function is transactionable and it registered own completion
|
* because that function is transactionable and it registered own completion
|
||||||
* entries in @tran, so .abort() for bdrv_replace_child_safe() will be
|
* entries in @tran, so .abort() for bdrv_replace_child_safe() will be
|
||||||
* called automatically.
|
* called automatically.
|
||||||
|
@ -4802,7 +4804,7 @@ static void bdrv_remove_filter_or_cow_child(BlockDriverState *bs,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child->bs) {
|
if (child->bs) {
|
||||||
bdrv_replace_child(child, NULL, tran);
|
bdrv_replace_child_tran(child, NULL, tran);
|
||||||
}
|
}
|
||||||
|
|
||||||
s = g_new(BdrvRemoveFilterOrCowChild, 1);
|
s = g_new(BdrvRemoveFilterOrCowChild, 1);
|
||||||
|
@ -4842,7 +4844,7 @@ static int bdrv_replace_node_noperm(BlockDriverState *from,
|
||||||
c->name, from->node_name);
|
c->name, from->node_name);
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
bdrv_replace_child(c, to, tran);
|
bdrv_replace_child_tran(c, to, tran);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue