[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/9] block: call bdrv_co_drain_begin in a coroutine
From: |
Kevin Wolf |
Subject: |
Re: [PATCH v2 1/9] block: call bdrv_co_drain_begin in a coroutine |
Date: |
Tue, 8 Nov 2022 16:20:46 +0100 |
Am 08.11.2022 um 15:33 hat Vladimir Sementsov-Ogievskiy geschrieben:
> On 11/4/22 12:56, Emanuele Giuseppe Esposito wrote:
> > It seems that bdrv_open_driver() forgot to create a coroutine
> > where to call bs->drv->bdrv_co_drain_begin(), a callback
> > marked as coroutine_fn.
> >
> > Because there is no active I/O at this point, the coroutine
> > should end right after entering, so the caller does not need
> > to poll until it is finished.
>
> Hmm. I see your point. But isn't it better to go the generic way and
> use a generated coroutine wrapper? Nothing guarantees that
> .bdrv_co_drain_begin() handlers will never do any yield point even on
> driver open...
>
> Look for example at bdrv_co_check(). It has a generated wrapper
> bdrv_check(), declared in include/block/block-io.h
>
> So you just need to declare the wrapper, and use it in
> bdrv_open_driver(), the code would be clearer too.
Note that if we apply the drain simplification series I sent today up to
at least patch 3 ('block: Revert .bdrv_drained_begin/end to
non-coroutine_fn') [1], then this patch isn't actually needed any more.
Kevin
[1] https://lists.gnu.org/archive/html/qemu-block/2022-11/msg00206.html
[PATCH v2 9/9] block/dirty-bitmap: remove unnecessary qemu_in_coroutine() case, Emanuele Giuseppe Esposito, 2022/11/04
[PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Emanuele Giuseppe Esposito, 2022/11/04
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Vladimir Sementsov-Ogievskiy, 2022/11/08
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Emanuele Giuseppe Esposito, 2022/11/08
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Vladimir Sementsov-Ogievskiy, 2022/11/08
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Vladimir Sementsov-Ogievskiy, 2022/11/08
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Emanuele Giuseppe Esposito, 2022/11/09
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Alberto Faria, 2022/11/09
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Paolo Bonzini, 2022/11/10
- Re: [PATCH v2 2/9] block-copy: add missing coroutine_fn annotations, Emanuele Giuseppe Esposito, 2022/11/15