Patchwork [RFC,10/13] block: disable I/O throttling outside main loop

login
register
mail settings
Submitter Stefan Hajnoczi
Date June 14, 2013, 9:48 a.m.
Message ID <1371203313-26490-11-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/251313/
State New
Headers show

Comments

Stefan Hajnoczi - June 14, 2013, 9:48 a.m.
Timers only work in the main loop.  This means threads running their own
AioContext cannot use I/O throttling for now.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block.c | 5 +++++
 1 file changed, 5 insertions(+)

Patch

diff --git a/block.c b/block.c
index d986fc8..2d7a0f8 100644
--- a/block.c
+++ b/block.c
@@ -169,6 +169,11 @@  static void bdrv_io_limits_intercept(BlockDriverState *bs,
 {
     int64_t wait_time = -1;
 
+    /* Timers currently only work in the main loop */
+    if (*get_thread_aio_context() != qemu_get_aio_context()) {
+        return;
+    }
+
     if (!qemu_co_queue_empty(&bs->throttled_reqs)) {
         qemu_co_queue_wait(&bs->throttled_reqs);
     }