On 5/7/21 10:12 AM, Emanuele Giuseppe Esposito wrote:
> Co-developed-by: Paolo Bonzini <[email protected]>
> Signed-off-by: Emanuele Giuseppe Esposito <[email protected]>
> ---
> block/blkdebug.c | 32 +++++++++++++++++++++++++++++++-
> 1 file changed, 31 insertions(+), 1 deletion(-)
>
> @@ -929,11 +956,14 @@ static bool
> blkdebug_debug_is_suspended(BlockDriverState *bs, const char *tag)
> BDRVBlkdebugState *s = bs->opaque;
> BlkdebugSuspendedReq *r;
>
> + qemu_mutex_lock(&s->lock);
> QLIST_FOREACH(r, &s->suspended_reqs, next) {
> if (!strcmp(r->tag, tag)) {
> + qemu_mutex_unlock(&s->lock);
> return true;
> }
> }
> + qemu_mutex_unlock(&s->lock);
> return false;
Would code like this be easier to write by using QEMU_LOCK_GUARD from
lockable.h?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org