Blame SOURCES/kvm-block-Remove-bdrv_drain_recurse.patch

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