|
From: | Paolo Bonzini |
Subject: | Re: [PATCH 1/9] block: call bdrv_co_drain_begin in a coroutine |
Date: | Thu, 3 Nov 2022 18:05:27 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 |
On 11/3/22 14:41, Emanuele Giuseppe Esposito wrote:
- for (i = 0; i < bs->quiesce_counter; i++) { - if (drv->bdrv_co_drain_begin) { - drv->bdrv_co_drain_begin(bs); - } + if (drv->bdrv_co_drain_begin) { + co = qemu_coroutine_create(bdrv_co_drain_begin, &dco); + qemu_coroutine_enter(co); + AIO_WAIT_WHILE(qemu_get_aio_context(), dco.ret == NOT_DONE); }
Alternatively there should be no reason for drv->bdrv_co_drain_begin to wait at this point, because the device does not have any active I/O. So you could also assert that the coroutine is terminated after qemu_coroutine_enter(), i.e. that dco.ret != NOT_DONE.
Since you need to respin, perhaps put it the above in the commit message in case this needs a change in the future; however your patch is simple and should indeed work, so
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |