[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] mirror: Skip block_job_defer_to_main_loop if alread

From: Fam Zheng
Subject: [Qemu-devel] [PATCH] mirror: Skip block_job_defer_to_main_loop if already in the main context
Date: Fri, 29 May 2015 10:22:13 +0800

mirror_exit does the replacing, which requires source and target to be
in sync, unfortunately we can't guarantee that before we have a complete
block pause mechanism. So for non-dataplane block jobs, let's do the old
thing as pre commit 5a7e7a0ba (block: let mirror blockjob run in BDS
AioContext) - directly call mirror_exit().

Dataplane case is taken care of in separate patches.

Suggested-by: Paolo Bonzini <address@hidden>
Signed-off-by: Fam Zheng <address@hidden>
 block/mirror.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/block/mirror.c b/block/mirror.c
index 58f391a..112393a 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -565,7 +565,11 @@ immediate_exit:
     data = g_malloc(sizeof(*data));
     data->ret = ret;
-    block_job_defer_to_main_loop(&s->common, mirror_exit, data);
+    if (bs->aio_context == qemu_get_aio_context()) {
+        mirror_exit(&s->common, data);
+    } else {
+        block_job_defer_to_main_loop(&s->common, mirror_exit, data);
+    }
 static void mirror_set_speed(BlockJob *job, int64_t speed, Error **errp)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]