While we look at the fixes for 2.11, I briefly prototyped this series to see if it makes sense as a simplification of the drain API for 2.12.
The idea is to let AioContext manage quiesce callbacks, then the block layer only needs to do the in-flight request waiting. This lets us get rid of the callback recursion (both up and down). Many commit logs and code comments are definitely missing, but it would be good to get high level review and maybe some testing already. Fam Fam Zheng (9): block: Remove unused bdrv_requests_pending aio: Add drain begin/end API to AioContext blockjob: Implement AioContext drain ops throttle: Implement AioContext drain ops qed: Implement AioContext drain ops block: Use aio_context_drained_begin in bdrv_set_aio_context block: Switch to use AIO drained begin/end API block: Drop old drained_{begin,end} callbacks blockjob: Drop unused functions block.c | 30 +-------- block/block-backend.c | 22 ------- block/io.c | 134 +++-------------------------------------- block/qed.c | 34 ++++++++--- block/throttle.c | 34 ++++++++--- blockjob.c | 67 ++++++++------------- include/block/aio.h | 27 ++++++++- include/block/block.h | 16 ----- include/block/block_int.h | 12 ---- include/block/blockjob_int.h | 14 ----- include/sysemu/block-backend.h | 8 --- util/async.c | 73 ++++++++++++++++++++++ 12 files changed, 186 insertions(+), 285 deletions(-) -- 2.14.3