aboutsummaryrefslogtreecommitdiff
path: root/include/block/block.h
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-03-23 12:40:41 +0100
committerKevin Wolf <kwolf@redhat.com>2018-06-18 15:03:25 +0200
commitfe4f0614ef9e361dae12012d3c400657444836cf (patch)
tree8a2fe7988f189a123c456e204bad9f1292f934de /include/block/block.h
parent4c8158e359d194394c64acd21caf5e3f3f3141c2 (diff)
block: Drain recursively with a single BDRV_POLL_WHILE()
Anything can happen inside BDRV_POLL_WHILE(), including graph changes that may interfere with its callers (e.g. child list iteration in recursive callers of bdrv_do_drained_begin). Switch to a single BDRV_POLL_WHILE() call for the whole subtree at the end of bdrv_do_drained_begin() to avoid such effects. The recursion happens now inside the loop condition. As the graph can only change between bdrv_drain_poll() calls, but not inside of it, doing the recursion here is safe. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/block/block.h')
-rw-r--r--include/block/block.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/block/block.h b/include/block/block.h
index cebbb39c6c..254ed2e4c9 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -570,10 +570,13 @@ void bdrv_parent_drained_end(BlockDriverState *bs, BdrvChild *ignore);
/**
* bdrv_drain_poll:
*
- * Poll for pending requests in @bs and its parents (except for
- * @ignore_parent). This is part of bdrv_drained_begin.
+ * Poll for pending requests in @bs, its parents (except for @ignore_parent),
+ * and if @recursive is true its children as well.
+ *
+ * This is part of bdrv_drained_begin.
*/
-bool bdrv_drain_poll(BlockDriverState *bs, BdrvChild *ignore_parent);
+bool bdrv_drain_poll(BlockDriverState *bs, bool recursive,
+ BdrvChild *ignore_parent);
/**
* bdrv_drained_begin: