On Thu, 05/28 13:47, Paolo Bonzini wrote: > > > On 28/05/2015 13:44, Fam Zheng wrote: > > > The reason for doing it in the block layer is that it's in one place and > > > we can be sure that it's applied. We can still in addition modify > > > specific users to avoid even trying to send requests, but I think it's > > > good to have the single place that always ensures correct functionality > > > of the drain instead of making it dependent on the user. > > > > How to do that for the synchronous blk_write callers that don't run in > > a coroutine? > > They would be completely oblivious to it. > > Their call to blk_co_write would queue the request. Then blk_write > calls aio_poll, which ultimately would result in blk_resume and unqueue > the request.
OK.. I thought that, then we have to make a rule that a blk_pause must be resolved by an aio_poll() loop. This is somehow tricky, for example I assume blk_write() would only call aio_poll() of its own AioContext? But the pairing blk_resume() will be in the main context. To make it worse, what if there is no BDS in the main context, should it be special cased in the block layer? Fam