[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-5.0 v2 2/3] block: Increase BB.in_flight for coroutine in
From: |
Kevin Wolf |
Subject: |
Re: [PATCH for-5.0 v2 2/3] block: Increase BB.in_flight for coroutine interfaces |
Date: |
Tue, 7 Apr 2020 11:48:14 +0200 |
User-agent: |
Mutt/1.12.1 (2019-06-15) |
Am 07.04.2020 um 11:10 hat Vladimir Sementsov-Ogievskiy geschrieben:
> 07.04.2020 11:52, Kevin Wolf wrote:
> > Am 07.04.2020 um 08:41 hat Vladimir Sementsov-Ogievskiy geschrieben:
> > > 06.04.2020 20:14, Kevin Wolf wrote:
> > > > External callers of blk_co_*() don't currently increase the
> > > > BlockBackend.in_flight counter, but calls from blk_aio_*() do, so there
> > > > is an inconsistency whether the counter has been increased or not.
> > > >
> > > > This patch moves the actual operations to static functions that can
> > > > later know they will always be called with in_flight increased exactly
> > > > once, even for external callers using the blk_co_*() coroutine
> > > > interfaces.
> > > >
> > > > If the public blk_co_*() interface is unused, remove it.
> > > >
> > > > Signed-off-by: Kevin Wolf <address@hidden>
> > >
> > >
> > > Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
> > >
> > > Still, did you consider instead just move inc/dec to _co_ functions, like
> > > [...]
> > > (and same for write, ioctl, flush, discard). It seems more
> > > consistent.. Should it work?
> >
> > No, it would be wrong because it would be too late. The main purpose of
> > blk_inc_in_flight() is to keep the request covered during the first and
> > the last phase outside of blk_co_*(), which can potentially involve BHs
> > like blk_aio_complete_bh().
>
> OK, thanks, I see now, we want to caver possible completion BH.
> Hmm, not too late but too early (for decrement).. As nothing interesting
> happening between increment in blk_aio_prwv and entering the coroutine with
> _do_ function.
Basically it covers everything that isn't yet covered by
bdrv_inc/dec_in_flight() on the node level, but completion is probably
the most important part.
Start, too, because actually something very interesting is happening
between blk_aio_prwv() and blk_do_*(): It uses bdrv_coroutine_enter(),
which in some circumstances may end up only scheduling the coroutine
instead of immediately entering it.
Kevin
Re: [PATCH for-5.0 v2 2/3] block: Increase BB.in_flight for coroutine interfaces, Max Reitz, 2020/04/07