Skip to contentSkip to conversation

block: add the support to drain throttled requests

PATCH In review [email protected] 1 participant 1 message Mar 27, 2012 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 block: add the support to drain throttled requests

From: Zhi Yong Wu <[email protected]>

---
 block.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
block.c +15 -1
index b88ee90..1fbf4dd 100644
@@ -862,8 +862,22 @@ void bdrv_close_all(void)
 void bdrv_drain_all(void)
 {
     BlockDriverState *bs;
+    bool busy;
 
-    qemu_aio_flush();
+    do {
+        busy = false;
+        qemu_aio_flush();
+
+        /* 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) {
Signature · 1 line
1.7.6