From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:47345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1nQU-0002nf-Gg for qemu-devel@nongnu.org; Sun, 07 Jun 2015 23:08:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z1nQT-0001UF-Ls for qemu-devel@nongnu.org; Sun, 07 Jun 2015 23:08:38 -0400 Date: Mon, 8 Jun 2015 11:08:29 +0800 From: Fam Zheng Message-ID: <20150608030829.GA10187@ad.nay.redhat.com> References: <1432866133-21111-1-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1432866133-21111-1-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH] mirror: Skip block_job_defer_to_main_loop if already in the main context List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , pbonzini@redhat.com, Jeff Cody , qemu-block@nongnu.org, stefanha@redhat.com On Fri, 05/29 10:22, Fam Zheng wrote: > 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 > > Suggested-by: Paolo Bonzini > Signed-off-by: Fam Zheng > --- > 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) > -- > 2.4.2 > >