qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org,
	stefanha@redhat.com, John Snow <jsnow@redhat.com>
Subject: [Qemu-devel] [PATCH 2/3] block/mirror: allow migration after sync
Date: Thu,  1 Oct 2015 12:34:32 -0400	[thread overview]
Message-ID: <1443717273-5280-3-git-send-email-jsnow@redhat.com> (raw)
In-Reply-To: <1443717273-5280-1-git-send-email-jsnow@redhat.com>

After the mirroring blockjob reaches synchronization,
allow migration to resume.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 block/mirror.c           | 2 ++
 blockjob.c               | 5 +++++
 include/block/blockjob.h | 8 ++++++++
 3 files changed, 15 insertions(+)

diff --git a/block/mirror.c b/block/mirror.c
index a258926..5eb469a 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -415,6 +415,7 @@ static void coroutine_fn mirror_run(void *opaque)
         /* Report BLOCK_JOB_READY and wait for complete. */
         block_job_event_ready(&s->common);
         s->synced = true;
+        block_job_allow_migration(&s->common);
         while (!block_job_is_cancelled(&s->common) && !s->should_complete) {
             block_job_yield(&s->common);
         }
@@ -540,6 +541,7 @@ static void coroutine_fn mirror_run(void *opaque)
                 if (!s->synced) {
                     block_job_event_ready(&s->common);
                     s->synced = true;
+                    block_job_allow_migration(&s->common);
                 }
 
                 should_complete = s->should_complete ||
diff --git a/blockjob.c b/blockjob.c
index b5849b3..bcb4fca 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -95,6 +95,11 @@ void block_job_release(BlockDriverState *bs)
     g_free(job);
 }
 
+void block_job_allow_migration(BlockJob *job)
+{
+    migrate_del_blocker(job->blocker);
+}
+
 void block_job_completed(BlockJob *job, int ret)
 {
     BlockDriverState *bs = job->bs;
diff --git a/include/block/blockjob.h b/include/block/blockjob.h
index dd9d5e6..2278484 100644
--- a/include/block/blockjob.h
+++ b/include/block/blockjob.h
@@ -147,6 +147,14 @@ void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs,
                        void *opaque, Error **errp);
 
 /**
+ * block_job_allow_migration:
+ * @job: The job to modify to lift its restriction on migrations.
+ *
+ * Lift this job's restriction on prohibiting outgoing migrations.
+ */
+void block_job_allow_migration(BlockJob *job);
+
+/**
  * block_job_sleep_ns:
  * @job: The job that calls the function.
  * @clock: The clock to sleep on.
-- 
2.4.3

  parent reply	other threads:[~2015-10-01 16:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01 16:34 [Qemu-devel] [PATCH 0/3] block: prohibit migrations during tasks John Snow
2015-10-01 16:34 ` [Qemu-devel] [PATCH 1/3] block: prohibit migration during BlockJobs John Snow
2015-10-01 18:03   ` Paolo Bonzini
2015-10-02 18:17     ` John Snow
2015-10-05  8:13       ` Kevin Wolf
2015-10-05 14:55       ` Paolo Bonzini
2015-10-01 16:34 ` John Snow [this message]
2015-10-01 16:34 ` [Qemu-devel] [PATCH 3/3] block: prohibit migration during transactions John Snow
2015-10-01 18:01   ` Paolo Bonzini
2015-10-02 18:20     ` John Snow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443717273-5280-3-git-send-email-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).