qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 04/11] bdrv_child_try_change_aio_context: add transaction


From: Emanuele Giuseppe Esposito
Subject: Re: [PATCH v2 04/11] bdrv_child_try_change_aio_context: add transaction parameter
Date: Mon, 24 Oct 2022 16:52:30 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0


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 <eesposit@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
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]