qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH 2/9] block: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUA


From: Eric Blake
Subject: Re: [PATCH 2/9] block: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARD
Date: Tue, 16 Mar 2021 08:29:43 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0

On 3/12/21 4:23 AM, Vladimir Sementsov-Ogievskiy wrote:
> 11.03.2021 06:15, Mahmoud Mandour wrote:
>> Replaced various qemu_mutex_lock/qemu_mutex_unlock calls with
>> lock guard macros (QEMU_LOCK_GUARD() and WITH_QEMU_LOCK_GUARD).
>> This slightly simplifies the code by eliminating calls to
>> qemu_mutex_unlock and eliminates goto paths.
>>
>> Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
>> ---
>>   block/curl.c |  13 ++--
>>   block/nbd.c  | 188 ++++++++++++++++++++++++---------------------------
> 
> Better would be make two separate patches I think.

Given the imminent approach of soft freeze, and the fact that this does
not add a feature, I'm debating whether this one patch warrants an
immediate pull request through my NBD tree, or if it should be split
first, or if we just defer it to 6.1 (it shouldn't affect correctness,
just a maintenance cleanup).

In case some other maintainer wants to push this series through for 6.0
(rather than waiting for each maintainer to pick up one patch at a
time), feel free to add:

Acked-by: Eric Blake <eblake@redhat.com>


> For nbd.c we mostly change simple critical sections
> 
> qemu_mutex_lock()
> ...
> qemu_mutex_unlock()
> 
> into
> 
> WITH_QEMU_LOCK_GUARD() {
> ...
> }
> 
> And don't eliminate any gotos.. Hmm. On the first sight increasing
> nesting of the code doesn't make it more beautiful.
> But I understand that context-manager concept is safer than calling
> unlock() by hand, and with nested block the critical section becomes
> more obvious. So, with fixed over-80 lines:
> 
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

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