[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/30] block: add the support to drain throttled req
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 01/30] block: add the support to drain throttled requests |
Date: |
Thu, 10 May 2012 13:49:05 +0200 |
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>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/block.c b/block.c
index ee7d8f2..a307fe1 100644
--- a/block.c
+++ b/block.c
@@ -906,12 +906,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 can come until the
+ * coroutine is complete. Because of this, it is not possible to have a
+ * function 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.6.5
- [Qemu-devel] [PULL 00/30] Block patches for 1.1, Kevin Wolf, 2012/05/10
- [Qemu-devel] [PATCH 01/30] block: add the support to drain throttled requests,
Kevin Wolf <=
- [Qemu-devel] [PATCH 03/30] block: fail live snapshot if disk has no medium, Kevin Wolf, 2012/05/10
- [Qemu-devel] [PATCH 04/30] block: push bdrv_change_backing_file error checking up from drivers, Kevin Wolf, 2012/05/10
- [Qemu-devel] [PATCH 10/30] qtest: Add floppy test, Kevin Wolf, 2012/05/10
- [Qemu-devel] [PATCH 06/30] block: open backing file as read-only when probing for size, Kevin Wolf, 2012/05/10
- [Qemu-devel] [PATCH 09/30] qtest: Add function to send QMP commands, Kevin Wolf, 2012/05/10
- [Qemu-devel] [PATCH 12/30] block: another bdrv_append fix, Kevin Wolf, 2012/05/10
- [Qemu-devel] [PATCH 07/30] block: fix allocation size for dirty bitmap, Kevin Wolf, 2012/05/10
- [Qemu-devel] [PATCH 02/30] block: add mode argument to blockdev-snapshot-sync, Kevin Wolf, 2012/05/10
- [Qemu-devel] [PATCH 05/30] block: update in-memory backing file and format, Kevin Wolf, 2012/05/10
- [Qemu-devel] [PATCH 14/30] block: fully delete bs->file when closing, Kevin Wolf, 2012/05/10