From c0778f6693213d0d6bfa7bee8045374a798db750 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Fri, 28 Oct 2016 10:08:02 +0300 Subject: block: Add bdrv_drain_all_{begin,end}() bdrv_drain_all() doesn't allow the caller to do anything after all pending requests have been completed but before block jobs are resumed. This patch splits bdrv_drain_all() into _begin() and _end() for that purpose. It also adds aio_{disable,enable}_external() calls to disable external clients in the meantime. An important restriction of this split is that no new block jobs or BlockDriverStates can be created between the bdrv_drain_all_begin() and bdrv_drain_all_end() calls. This is not a concern now because we'll only be using this in bdrv_reopen_multiple(), but it must be dealt with if we ever have other uses cases in the future. Signed-off-by: Alberto Garcia Cc: Paolo Bonzini Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- include/block/block.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/block/block.h') diff --git a/include/block/block.h b/include/block/block.h index b7dc7d5..b81a3e3 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -332,6 +332,8 @@ int bdrv_flush_all(void); void bdrv_close_all(void); void bdrv_drain(BlockDriverState *bs); void coroutine_fn bdrv_co_drain(BlockDriverState *bs); +void bdrv_drain_all_begin(void); +void bdrv_drain_all_end(void); void bdrv_drain_all(void); #define BDRV_POLL_WHILE(bs, cond) ({ \ -- cgit v1.1