|
|
383d26 |
From 72f0fcad0938bba82537e78753e242d53f3f2583 Mon Sep 17 00:00:00 2001
|
|
|
383d26 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
Date: Fri, 14 Sep 2018 10:55:10 +0200
|
|
|
383d26 |
Subject: [PATCH 19/49] block: Don't poll in parent drain callbacks
|
|
|
383d26 |
|
|
|
383d26 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
Message-id: <20180914105540.18077-13-kwolf@redhat.com>
|
|
|
383d26 |
Patchwork-id: 82164
|
|
|
383d26 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 12/42] block: Don't poll in parent drain callbacks
|
|
|
383d26 |
Bugzilla: 1601212
|
|
|
383d26 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
bdrv_do_drained_begin() is only safe if we have a single
|
|
|
383d26 |
BDRV_POLL_WHILE() after quiescing all affected nodes. We cannot allow
|
|
|
383d26 |
that parent callbacks introduce a nested polling loop that could cause
|
|
|
383d26 |
graph changes while we're traversing the graph.
|
|
|
383d26 |
|
|
|
383d26 |
Split off bdrv_do_drained_begin_quiesce(), which only quiesces a single
|
|
|
383d26 |
node without waiting for its requests to complete. These requests will
|
|
|
383d26 |
be waited for in the BDRV_POLL_WHILE() call down the call chain.
|
|
|
383d26 |
|
|
|
383d26 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
(cherry picked from commit dcf94a23b1add0f856db51e9ff5ba0774e096076)
|
|
|
383d26 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
383d26 |
---
|
|
|
383d26 |
block.c | 2 +-
|
|
|
383d26 |
block/io.c | 24 ++++++++++++++++--------
|
|
|
383d26 |
include/block/block.h | 9 +++++++++
|
|
|
383d26 |
3 files changed, 26 insertions(+), 9 deletions(-)
|
|
|
383d26 |
|
|
|
383d26 |
diff --git a/block.c b/block.c
|
|
|
383d26 |
index 9afaf26..5a50de6 100644
|
|
|
383d26 |
--- a/block.c
|
|
|
383d26 |
+++ b/block.c
|
|
|
383d26 |
@@ -818,7 +818,7 @@ static char *bdrv_child_get_parent_desc(BdrvChild *c)
|
|
|
383d26 |
static void bdrv_child_cb_drained_begin(BdrvChild *child)
|
|
|
383d26 |
{
|
|
|
383d26 |
BlockDriverState *bs = child->opaque;
|
|
|
383d26 |
- bdrv_drained_begin(bs);
|
|
|
383d26 |
+ bdrv_do_drained_begin_quiesce(bs, NULL);
|
|
|
383d26 |
}
|
|
|
383d26 |
|
|
|
383d26 |
static bool bdrv_child_cb_drained_poll(BdrvChild *child)
|
|
|
383d26 |
diff --git a/block/io.c b/block/io.c
|
|
|
383d26 |
index 442ded1..9c41ff9 100644
|
|
|
383d26 |
--- a/block/io.c
|
|
|
383d26 |
+++ b/block/io.c
|
|
|
383d26 |
@@ -285,15 +285,10 @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs,
|
|
|
383d26 |
assert(data.done);
|
|
|
383d26 |
}
|
|
|
383d26 |
|
|
|
383d26 |
-void bdrv_do_drained_begin(BlockDriverState *bs, bool recursive,
|
|
|
383d26 |
- BdrvChild *parent, bool poll)
|
|
|
383d26 |
+void bdrv_do_drained_begin_quiesce(BlockDriverState *bs,
|
|
|
383d26 |
+ BdrvChild *parent)
|
|
|
383d26 |
{
|
|
|
383d26 |
- BdrvChild *child, *next;
|
|
|
383d26 |
-
|
|
|
383d26 |
- if (qemu_in_coroutine()) {
|
|
|
383d26 |
- bdrv_co_yield_to_drain(bs, true, recursive, parent, poll);
|
|
|
383d26 |
- return;
|
|
|
383d26 |
- }
|
|
|
383d26 |
+ assert(!qemu_in_coroutine());
|
|
|
383d26 |
|
|
|
383d26 |
/* Stop things in parent-to-child order */
|
|
|
383d26 |
if (atomic_fetch_inc(&bs->quiesce_counter) == 0) {
|
|
|
383d26 |
@@ -302,6 +297,19 @@ void bdrv_do_drained_begin(BlockDriverState *bs, bool recursive,
|
|
|
383d26 |
|
|
|
383d26 |
bdrv_parent_drained_begin(bs, parent);
|
|
|
383d26 |
bdrv_drain_invoke(bs, true);
|
|
|
383d26 |
+}
|
|
|
383d26 |
+
|
|
|
383d26 |
+static void bdrv_do_drained_begin(BlockDriverState *bs, bool recursive,
|
|
|
383d26 |
+ BdrvChild *parent, bool poll)
|
|
|
383d26 |
+{
|
|
|
383d26 |
+ BdrvChild *child, *next;
|
|
|
383d26 |
+
|
|
|
383d26 |
+ if (qemu_in_coroutine()) {
|
|
|
383d26 |
+ bdrv_co_yield_to_drain(bs, true, recursive, parent, poll);
|
|
|
383d26 |
+ return;
|
|
|
383d26 |
+ }
|
|
|
383d26 |
+
|
|
|
383d26 |
+ bdrv_do_drained_begin_quiesce(bs, parent);
|
|
|
383d26 |
|
|
|
383d26 |
if (recursive) {
|
|
|
383d26 |
bs->recursive_quiesce_counter++;
|
|
|
383d26 |
diff --git a/include/block/block.h b/include/block/block.h
|
|
|
383d26 |
index 2bbea7c..43f29b5 100644
|
|
|
383d26 |
--- a/include/block/block.h
|
|
|
383d26 |
+++ b/include/block/block.h
|
|
|
383d26 |
@@ -619,6 +619,15 @@ bool bdrv_drain_poll(BlockDriverState *bs, bool recursive,
|
|
|
383d26 |
void bdrv_drained_begin(BlockDriverState *bs);
|
|
|
383d26 |
|
|
|
383d26 |
/**
|
|
|
383d26 |
+ * bdrv_do_drained_begin_quiesce:
|
|
|
383d26 |
+ *
|
|
|
383d26 |
+ * Quiesces a BDS like bdrv_drained_begin(), but does not wait for already
|
|
|
383d26 |
+ * running requests to complete.
|
|
|
383d26 |
+ */
|
|
|
383d26 |
+void bdrv_do_drained_begin_quiesce(BlockDriverState *bs,
|
|
|
383d26 |
+ BdrvChild *parent);
|
|
|
383d26 |
+
|
|
|
383d26 |
+/**
|
|
|
383d26 |
* Like bdrv_drained_begin, but recursively begins a quiesced section for
|
|
|
383d26 |
* exclusive access to all child nodes as well.
|
|
|
383d26 |
*/
|
|
|
383d26 |
--
|
|
|
383d26 |
1.8.3.1
|
|
|
383d26 |
|