Skip to contentSkip to conversation

mirror: Skip block_job_defer_to_main_loop if already in the main context

PATCH In review Fam Zheng 3 participants 5 messages May 29, 2015 – Jun 8, 2015 Block layer

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 mirror: Skip block_job_defer_to_main_loop if already in the main context

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.

---
 block/mirror.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
block/mirror.c +5 -1
index 58f391a..112393a 100644
@@ -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)
Signature · 1 line
2.4.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Fam Zheng

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().

Quoted 7 lines

Dataplane case is taken care of in separate patches.

---
 block/mirror.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Please CC Jeff Cody <[email protected]> on blockjob patches.

author
#2 lore raw
Quoted 9 lines · Stefan Hajnoczi
Quoted 8 lines · Fam Zheng

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.

Quoted 7 lines
Quoted 5 lines
---
 block/mirror.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Please CC Jeff Cody <[email protected]> on blockjob patches.

Didn't I?

Fam

#3 lore raw
Quoted 16 lines · Fam Zheng
Quoted 15 lines · Stefan Hajnoczi
Quoted 13 lines · Fam Zheng

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.

---
 block/mirror.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Quoted 3 lines
Quoted 1 line

Please CC Jeff Cody <[email protected]> on blockjob patches.

Didn't I?

Oops, sorry I missed it.

Stefan

author
#4 lore raw
In reply to Fam Zheng
Quoted 7 lines · Fam Zheng

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.

This one is superceded by

[PATCH v2 07/13] mirror: Protect source between bdrv_drain and bdrv_swap

Fam

Quoted 28 lines
---
 block/mirror.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
block/mirror.c +5 -1
index 58f391a..112393a 100644
@@ -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)
Signature · 1 line
2.4.2