|
|
ae23c9 |
From e6d8bc54a031c61c1fce2c9e1ccdb821b5991c1a Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Date: Wed, 10 Oct 2018 20:08:42 +0100
|
|
|
ae23c9 |
Subject: [PATCH 11/49] block: Remove bdrv_drain_recurse()
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Message-id: <20181010200843.6710-9-kwolf@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 82588
|
|
|
ae23c9 |
O-Subject: [RHEL-8 qemu-kvm PATCH 08/44] block: Remove bdrv_drain_recurse()
|
|
|
ae23c9 |
Bugzilla: 1637976
|
|
|
ae23c9 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
For bdrv_drain(), recursively waiting for child node requests is
|
|
|
ae23c9 |
pointless because we didn't quiesce their parents, so new requests could
|
|
|
ae23c9 |
come in anyway. Letting the function work only on a single node makes it
|
|
|
ae23c9 |
more consistent.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
For subtree drains and drain_all, we already have the recursion in
|
|
|
ae23c9 |
bdrv_do_drained_begin(), so the extra recursion doesn't add anything
|
|
|
ae23c9 |
either.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Remove the useless code.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit d30b8e64b7b282da785307504ada59efa8096fb1)
|
|
|
ae23c9 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
block/io.c | 36 +++---------------------------------
|
|
|
ae23c9 |
1 file changed, 3 insertions(+), 33 deletions(-)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/block/io.c b/block/io.c
|
|
|
ae23c9 |
index e260394..a0e3461 100644
|
|
|
ae23c9 |
--- a/block/io.c
|
|
|
ae23c9 |
+++ b/block/io.c
|
|
|
ae23c9 |
@@ -218,38 +218,6 @@ static bool bdrv_drain_poll_top_level(BlockDriverState *bs,
|
|
|
ae23c9 |
return bdrv_drain_poll(bs, ignore_parent);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
-static bool bdrv_drain_recurse(BlockDriverState *bs, BdrvChild *parent)
|
|
|
ae23c9 |
-{
|
|
|
ae23c9 |
- BdrvChild *child, *tmp;
|
|
|
ae23c9 |
- bool waited;
|
|
|
ae23c9 |
-
|
|
|
ae23c9 |
- /* Wait for drained requests to finish */
|
|
|
ae23c9 |
- waited = BDRV_POLL_WHILE(bs, bdrv_drain_poll_top_level(bs, parent));
|
|
|
ae23c9 |
-
|
|
|
ae23c9 |
- QLIST_FOREACH_SAFE(child, &bs->children, next, tmp) {
|
|
|
ae23c9 |
- BlockDriverState *bs = child->bs;
|
|
|
ae23c9 |
- bool in_main_loop =
|
|
|
ae23c9 |
- qemu_get_current_aio_context() == qemu_get_aio_context();
|
|
|
ae23c9 |
- assert(bs->refcnt > 0);
|
|
|
ae23c9 |
- if (in_main_loop) {
|
|
|
ae23c9 |
- /* In case the recursive bdrv_drain_recurse processes a
|
|
|
ae23c9 |
- * block_job_defer_to_main_loop BH and modifies the graph,
|
|
|
ae23c9 |
- * let's hold a reference to bs until we are done.
|
|
|
ae23c9 |
- *
|
|
|
ae23c9 |
- * IOThread doesn't have such a BH, and it is not safe to call
|
|
|
ae23c9 |
- * bdrv_unref without BQL, so skip doing it there.
|
|
|
ae23c9 |
- */
|
|
|
ae23c9 |
- bdrv_ref(bs);
|
|
|
ae23c9 |
- }
|
|
|
ae23c9 |
- waited |= bdrv_drain_recurse(bs, child);
|
|
|
ae23c9 |
- if (in_main_loop) {
|
|
|
ae23c9 |
- bdrv_unref(bs);
|
|
|
ae23c9 |
- }
|
|
|
ae23c9 |
- }
|
|
|
ae23c9 |
-
|
|
|
ae23c9 |
- return waited;
|
|
|
ae23c9 |
-}
|
|
|
ae23c9 |
-
|
|
|
ae23c9 |
static void bdrv_do_drained_begin(BlockDriverState *bs, bool recursive,
|
|
|
ae23c9 |
BdrvChild *parent);
|
|
|
ae23c9 |
static void bdrv_do_drained_end(BlockDriverState *bs, bool recursive,
|
|
|
ae23c9 |
@@ -317,7 +285,9 @@ void bdrv_do_drained_begin(BlockDriverState *bs, bool recursive,
|
|
|
ae23c9 |
|
|
|
ae23c9 |
bdrv_parent_drained_begin(bs, parent);
|
|
|
ae23c9 |
bdrv_drain_invoke(bs, true);
|
|
|
ae23c9 |
- bdrv_drain_recurse(bs, parent);
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ /* Wait for drained requests to finish */
|
|
|
ae23c9 |
+ BDRV_POLL_WHILE(bs, bdrv_drain_poll_top_level(bs, parent));
|
|
|
ae23c9 |
|
|
|
ae23c9 |
if (recursive) {
|
|
|
ae23c9 |
bs->recursive_quiesce_counter++;
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|