summaryrefslogtreecommitdiffstats
path: root/include/block/block.h
diff options
context:
space:
mode:
authorKevin Wolf2018-05-29 17:17:45 +0200
committerKevin Wolf2018-06-18 15:03:25 +0200
commit6cd5c9d7b2df93ef54144f170d4c908934a4767f (patch)
tree7b7787f054ba88d540e0741f03187aece7b921f1 /include/block/block.h
parentblock: Move bdrv_drain_all_begin() out of coroutine context (diff)
downloadqemu-6cd5c9d7b2df93ef54144f170d4c908934a4767f.tar.gz
qemu-6cd5c9d7b2df93ef54144f170d4c908934a4767f.tar.xz
qemu-6cd5c9d7b2df93ef54144f170d4c908934a4767f.zip
block: ignore_bds_parents parameter for drain functions
In the future, bdrv_drained_all_begin/end() will drain all invidiual nodes separately rather than whole subtrees. This means that we don't want to propagate the drain to all parents any more: If the parent is a BDS, it will already be drained separately. Recursing to all parents is unnecessary work and would make it an O(n²) operation. Prepare the drain function for the changed drain_all by adding an ignore_bds_parents parameter to the internal implementation that prevents the propagation of the drain to BDS parents. We still (have to) propagate it to non-BDS parents like BlockBackends or Jobs because those are not drained separately. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/block/block.h')
-rw-r--r--include/block/block.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/include/block/block.h b/include/block/block.h
index 067d24cc4a..836746e4e1 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -557,7 +557,8 @@ void bdrv_io_unplug(BlockDriverState *bs);
* Begin a quiesced section of all users of @bs. This is part of
* bdrv_drained_begin.
*/
-void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ignore);
+void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ignore,
+ bool ignore_bds_parents);
/**
* bdrv_parent_drained_end:
@@ -565,18 +566,23 @@ void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ignore);
* End a quiesced section of all users of @bs. This is part of
* bdrv_drained_end.
*/
-void bdrv_parent_drained_end(BlockDriverState *bs, BdrvChild *ignore);
+void bdrv_parent_drained_end(BlockDriverState *bs, BdrvChild *ignore,
+ bool ignore_bds_parents);
/**
* bdrv_drain_poll:
*
* Poll for pending requests in @bs, its parents (except for @ignore_parent),
- * and if @recursive is true its children as well.
+ * and if @recursive is true its children as well (used for subtree drain).
+ *
+ * If @ignore_bds_parents is true, parents that are BlockDriverStates must
+ * ignore the drain request because they will be drained separately (used for
+ * drain_all).
*
* This is part of bdrv_drained_begin.
*/
bool bdrv_drain_poll(BlockDriverState *bs, bool recursive,
- BdrvChild *ignore_parent);
+ BdrvChild *ignore_parent, bool ignore_bds_parents);
/**
* bdrv_drained_begin:
@@ -597,7 +603,7 @@ void bdrv_drained_begin(BlockDriverState *bs);
* running requests to complete.
*/
void bdrv_do_drained_begin_quiesce(BlockDriverState *bs,
- BdrvChild *parent);
+ BdrvChild *parent, bool ignore_bds_parents);
/**
* Like bdrv_drained_begin, but recursively begins a quiesced section for