[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v2 2/4] block: Pause block jobs in bdrv_drain_all
From: |
Fam Zheng |
Subject: |
[Qemu-block] [PATCH v2 2/4] block: Pause block jobs in bdrv_drain_all |
Date: |
Fri, 3 Apr 2015 22:05:19 +0800 |
This is necessary to suppress more IO requests from being generated from
block job coroutines.
Signed-off-by: Fam Zheng <address@hidden>
---
block.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/block.c b/block.c
index f2f8ae7..00cd91e 100644
--- a/block.c
+++ b/block.c
@@ -2033,6 +2033,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;
@@ -2044,6 +2054,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
--
2.1.0
- Re: [Qemu-block] [PATCH v2 3/4] qemu-iotests: Test that "stop" doesn't drain block jobs, (continued)
[Qemu-block] [PATCH v2 4/4] blockjob: Update function name in comments, Fam Zheng, 2015/04/03
[Qemu-block] [PATCH v2 1/4] blockjob: Allow nested pause, Fam Zheng, 2015/04/03
[Qemu-block] [PATCH v2 2/4] block: Pause block jobs in bdrv_drain_all,
Fam Zheng <=
Re: [Qemu-block] [PATCH v2 0/4] Fix "stop" draining block jobs, Stefan Hajnoczi, 2015/04/08
Re: [Qemu-block] [PATCH v2 0/4] Fix "stop" draining block jobs, Stefan Hajnoczi, 2015/04/20