Signed-off-by: Liu Ping Fan <pingf...@linux.vnet.ibm.com>
---
 block.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/block.c b/block.c
index c6b7b6c..b9e6cc8 100644
--- a/block.c
+++ b/block.c
@@ -149,7 +149,12 @@ static void bdrv_block_timer(void *opaque)
 void bdrv_io_limits_enable(BlockDriverState *bs)
 {
     qemu_co_queue_init(&bs->throttled_reqs);
-    bs->block_timer = qemu_new_timer_ns(vm_clock, bdrv_block_timer, bs);
+    if (!bs->ctx) {
+        bs->block_timer = qemu_new_timer_ns(vm_clock, bdrv_block_timer, bs);
+    } else {
+        bs->block_timer = aioctx_new_timer_ns(vm_clock, bdrv_block_timer, bs,
+                        bs->ctx);
+    }
     bs->io_limits_enabled = true;
 }
 
-- 
1.8.1.4


Reply via email to