Re: [PATCH 4/6] progressmeter: protect with a mutex

2021-05-12 Thread Stefan Hajnoczi
On Mon, May 10, 2021 at 10:59:39AM +0200, Emanuele Giuseppe Esposito wrote: > Progressmeter is protected by the AioContext mutex, which > is taken by the block jobs and their caller (like blockdev). > > We would like to remove the dependency of block layer code on the > AioContext mutex, since

Re: [PATCH 4/6] progressmeter: protect with a mutex

2021-05-12 Thread Vladimir Sementsov-Ogievskiy
11.05.2021 15:28, Paolo Bonzini wrote: On 10/05/21 13:28, Vladimir Sementsov-Ogievskiy wrote: Could we instead add a c file and add the structure private? Then we'll have progress_new() and progress_free() APIs instead. This way, it would be a lot simpler to control that nobady use

Re: [PATCH 4/6] progressmeter: protect with a mutex

2021-05-11 Thread Paolo Bonzini
On 10/05/21 13:28, Vladimir Sementsov-Ogievskiy wrote: Could we instead add a c file and add the structure private? Then we'll have progress_new() and progress_free() APIs instead. This way, it would be a lot simpler to control that nobady use structure fields directly. I don't know...

Re: [PATCH 4/6] progressmeter: protect with a mutex

2021-05-10 Thread Emanuele Giuseppe Esposito
We don't have caller that pass only one pointer. So we can just do *current = pm->current; *total = pm->total; implicitly requiring both pointers to be non NULL. Is it so performance critical that we need to skip these safety checks? IMHO we can keep it as it is. Not performance. It's

Re: [PATCH 4/6] progressmeter: protect with a mutex

2021-05-10 Thread Vladimir Sementsov-Ogievskiy
10.05.2021 19:52, Emanuele Giuseppe Esposito wrote: On 10/05/2021 13:28, Vladimir Sementsov-Ogievskiy wrote: 10.05.2021 11:59, Emanuele Giuseppe Esposito wrote: Progressmeter is protected by the AioContext mutex, which is taken by the block jobs and their caller (like blockdev). We would

Re: [PATCH 4/6] progressmeter: protect with a mutex

2021-05-10 Thread Emanuele Giuseppe Esposito
On 10/05/2021 13:28, Vladimir Sementsov-Ogievskiy wrote: 10.05.2021 11:59, Emanuele Giuseppe Esposito wrote: Progressmeter is protected by the AioContext mutex, which is taken by the block jobs and their caller (like blockdev). We would like to remove the dependency of block layer code on

Re: [PATCH 4/6] progressmeter: protect with a mutex

2021-05-10 Thread Vladimir Sementsov-Ogievskiy
10.05.2021 11:59, Emanuele Giuseppe Esposito wrote: Progressmeter is protected by the AioContext mutex, which is taken by the block jobs and their caller (like blockdev). We would like to remove the dependency of block layer code on the AioContext mutex, since most drivers and the core I/O code

[PATCH 4/6] progressmeter: protect with a mutex

2021-05-10 Thread Emanuele Giuseppe Esposito
Progressmeter is protected by the AioContext mutex, which is taken by the block jobs and their caller (like blockdev). We would like to remove the dependency of block layer code on the AioContext mutex, since most drivers and the core I/O code are already not relying on it. The simplest thing to