Am 07/10/2022 um 18:10 schrieb Kevin Wolf: > Am 25.07.2022 um 14:21 hat Emanuele Giuseppe Esposito geschrieben: >> This enables the caller to use the same transaction to also >> keep track of aiocontext changes. >> >> Signed-off-by: Emanuele Giuseppe Esposito <eespo...@redhat.com> > > What you're really doing here is factoring out the recursive phase. > However, the factored out function is never used from anywhere else, > so I don't understand the purpose of this patch. It feels like an > unnecessary complication of the code. > > The commit message is unclear to me, too: Who is the caller of > bdrv_child_try_change_aio_context() that it mentions, and why does it > make a difference to it how the code is organised internally? So this was an initial (mis)understanding from what Vladimir suggested, where everything should be part of a single transaction. If you want, I can drop this. Thank you, Emanuele > > Is this some artifact of changes you made and we don't need it any more > now? > >> block.c | 31 ++++++++++++++++++++++++------ >> include/block/block-global-state.h | 5 +++++ >> 2 files changed, 30 insertions(+), 6 deletions(-) >> >> diff --git a/block.c b/block.c >> index c02a628336..221bf90268 100644 >> --- a/block.c >> +++ b/block.c >> @@ -7643,17 +7643,16 @@ int bdrv_child_try_set_aio_context(BlockDriverState >> *bs, AioContext *ctx, >> * For the same reason, it temporarily holds also the new AioContext, since >> * bdrv_drained_end calls BDRV_POLL_WHILE that assumes the lock is taken >> too. >> */ >> -int bdrv_child_try_change_aio_context(BlockDriverState *bs, AioContext *ctx, >> - BdrvChild *ignore_child, Error **errp) >> +int bdrv_child_try_change_aio_context_tran(BlockDriverState *bs, >> + AioContext *ctx, >> + BdrvChild *ignore_child, >> + Transaction *tran, >> + Error **errp) > > As mentioned above, this is never used anywhere else than from > bdrv_child_try_change_aio_context(), so if we want to keep the patch, it > should be static at least. > > Maybe find a better name, too, because all of the transaction related > operations are in the caller. > > The function comment is not accurate any more either because it > described the whole of bdrv_child_try_change_aio_context(), while this > function only contains the recursive part. > > Kevin >