]> Git Repo - qemu.git/commitdiff
block: Pause block jobs in bdrv_drain_all
authorFam Zheng <[email protected]>
Fri, 3 Apr 2015 14:05:19 +0000 (22:05 +0800)
committerKevin Wolf <[email protected]>
Tue, 28 Apr 2015 13:36:09 +0000 (15:36 +0200)
This is necessary to suppress more IO requests from being generated from
block job coroutines.

Signed-off-by: Fam Zheng <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Reviewed-by: Alberto Garcia <[email protected]>
Message-id: 1428069921[email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
block.c

diff --git a/block.c b/block.c
index 670d7e4fc261b63a90f44075cbfe9f6f82caa647..70aed80089c2bc23b2299ea8e348c0737837dd68 100644 (file)
--- a/block.c
+++ b/block.c
@@ -2040,6 +2040,16 @@ void bdrv_drain_all(void)
     bool busy = true;
     BlockDriverState *bs;
 
+    QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
+        AioContext *aio_context = bdrv_get_aio_context(bs);
+
+        aio_context_acquire(aio_context);
+        if (bs->job) {
+            block_job_pause(bs->job);
+        }
+        aio_context_release(aio_context);
+    }
+
     while (busy) {
         busy = false;
 
@@ -2051,6 +2061,16 @@ void bdrv_drain_all(void)
             aio_context_release(aio_context);
         }
     }
+
+    QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
+        AioContext *aio_context = bdrv_get_aio_context(bs);
+
+        aio_context_acquire(aio_context);
+        if (bs->job) {
+            block_job_resume(bs->job);
+        }
+        aio_context_release(aio_context);
+    }
 }
 
 /* make a BlockDriverState anonymous by removing from bdrv_state and
This page took 0.051102 seconds and 4 git commands to generate.