[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 7/7] block: add the support to drain throttled reque
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 7/7] block: add the support to drain throttled requests |
Date: |
Mon, 12 Mar 2012 19:22:28 +0100 |
From: Zhi Yong Wu <address@hidden>
Signed-off-by: Zhi Yong Wu <address@hidden>
[ Iterate until all block devices have processed all requests,
add comments. - Paolo ]
Signed-off-by: Paolo Bonzini <address@hidden>
---
block.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/block.c b/block.c
index dac62a1..0d769a6 100644
--- a/block.c
+++ b/block.c
@@ -858,12 +858,31 @@ void bdrv_close_all(void)
*
* This function does not flush data to disk, use bdrv_flush_all() for that
* after calling this function.
+ *
+ * Note that completion of an asynchronous I/O operation can trigger any
+ * number of other I/O operations on other devices---for example a coroutine
+ * can be arbitrarily complex and a constant flow of I/O to multiple devices
+ * can come until the coroutine is complete. Because of this, it is not
+ * possible to drain a single device's I/O queue.
*/
void bdrv_drain_all(void)
{
BlockDriverState *bs;
+ bool busy;
- qemu_aio_flush();
+ do {
+ busy = qemu_aio_wait();
+
+ /* FIXME: We do not have timer support here, so this is effectively
+ * a busy wait.
+ */
+ QTAILQ_FOREACH(bs, &bdrv_states, list) {
+ if (!qemu_co_queue_empty(&bs->throttled_reqs)) {
+ qemu_co_queue_restart_all(&bs->throttled_reqs);
+ busy = true;
+ }
+ }
+ } while (busy);
/* If requests are still pending there is a bug somewhere */
QTAILQ_FOREACH(bs, &bdrv_states, list) {
--
1.7.7.6
- [Qemu-devel] [PATCH 0/7] AIO nested loop and bdrv_drain_all changes, Paolo Bonzini, 2012/03/12
- [Qemu-devel] [PATCH 1/7] qemu-io: use main_loop_wait, Paolo Bonzini, 2012/03/12
- [Qemu-devel] [PATCH 3/7] posix-aio: merge posix_aio_process_queue and posix_aio_read, Paolo Bonzini, 2012/03/12
- [Qemu-devel] [PATCH 7/7] block: add the support to drain throttled requests,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 4/7] aio: remove process_queue callback and qemu_aio_process_queue, Paolo Bonzini, 2012/03/12
- [Qemu-devel] [PATCH 5/7] aio: return "AIO in progress" state from qemu_aio_wait, Paolo Bonzini, 2012/03/12
- [Qemu-devel] [PATCH 2/7] qemu-tool: map vm_clock to rt_clock, Paolo Bonzini, 2012/03/12
- [Qemu-devel] [PATCH 6/7] aio: simplify qemu_aio_wait, Paolo Bonzini, 2012/03/12