[Qemu-devel] [PATCH v2 6/9] block: Add bdrv_drained_end_no_poll()

Max Reitz posted 9 patches 6 years, 4 months ago
Maintainers: Fam Zheng <fam@euphon.net>, Stefan Hajnoczi <stefanha@redhat.com>, Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>
There is a newer version of this series
[Qemu-devel] [PATCH v2 6/9] block: Add bdrv_drained_end_no_poll()
Posted by Max Reitz 6 years, 4 months ago
In contrast to bdrv_drained_end(), which does poll and may thus lead to
graph changes, this new interface to bdrv_do_drained_end() will not
poll.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 include/block/block.h | 12 +++++++++++-
 block/io.c            |  5 +++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/include/block/block.h b/include/block/block.h
index d98237f0f1..422448d773 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -680,10 +680,20 @@ void bdrv_subtree_drained_begin(BlockDriverState *bs);
 /**
  * bdrv_drained_end:
  *
- * End a quiescent section started by bdrv_drained_begin().
+ * End a quiescent section started by bdrv_drained_begin().  This may
+ * result in block graph changes.
  */
 void bdrv_drained_end(BlockDriverState *bs);
 
+/**
+ * bdrv_drained_end_no_poll:
+ *
+ * Same as bdrv_drained_end(), but do not poll for the subgraph to
+ * actually become unquiesced.  Therefore, no graph changes will occur
+ * with this function.
+ */
+void bdrv_drained_end_no_poll(BlockDriverState *bs);
+
 /**
  * End a quiescent section started by bdrv_subtree_drained_begin().
  */
diff --git a/block/io.c b/block/io.c
index 5f30baa8e5..188dea22bc 100644
--- a/block/io.c
+++ b/block/io.c
@@ -539,6 +539,11 @@ void bdrv_drained_end(BlockDriverState *bs)
     bdrv_do_drained_end(bs, false, NULL, false, true, NULL);
 }
 
+void bdrv_drained_end_no_poll(BlockDriverState *bs)
+{
+    bdrv_do_drained_end(bs, false, NULL, false, false, NULL);
+}
+
 void bdrv_subtree_drained_end(BlockDriverState *bs)
 {
     bdrv_do_drained_end(bs, true, NULL, false, true, NULL);
-- 
2.21.0