qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH 3/6] block: convert bdrv_graph_wrlock() to AIO_WAIT_WHILE_UNL


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 3/6] block: convert bdrv_graph_wrlock() to AIO_WAIT_WHILE_UNLOCKED()
Date: Tue, 7 Mar 2023 21:37:30 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

On 2/3/23 11:19, Philippe Mathieu-Daudé wrote:
On 1/3/23 21:57, Stefan Hajnoczi wrote:
The following conversion is safe and does not change behavior:

      GLOBAL_STATE_CODE();
      ...
   -  AIO_WAIT_WHILE(qemu_get_aio_context(), ...);
   +  AIO_WAIT_WHILE_UNLOCKED(NULL, ...);

Since we're in GLOBAL_STATE_CODE(), qemu_get_aio_context() is our home
thread's AioContext. Thus AIO_WAIT_WHILE() does not unlock the
AioContext:

   if (ctx_ && in_aio_context_home_thread(ctx_)) {                \
       while ((cond)) {                                           \
           aio_poll(ctx_, true);                                  \
           waited_ = true;                                        \
       }                                                          \

And that means AIO_WAIT_WHILE_UNLOCKED(NULL, ...) can be substituted.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
  block/graph-lock.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>




reply via email to

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