From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOkZU-0005hf-OU for qemu-devel@nongnu.org; Thu, 18 Oct 2012 03:31:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOkZO-0000ge-Rq for qemu-devel@nongnu.org; Thu, 18 Oct 2012 03:31:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOkZO-0000gX-Jd for qemu-devel@nongnu.org; Thu, 18 Oct 2012 03:31:06 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9I7V5Ij029423 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 18 Oct 2012 03:31:06 -0400 From: Juan Quintela Date: Thu, 18 Oct 2012 09:30:17 +0200 Message-Id: <1350545426-23172-22-git-send-email-quintela@redhat.com> In-Reply-To: <1350545426-23172-1-git-send-email-quintela@redhat.com> References: <1350545426-23172-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 21/30] migration: move exit condition to migration thread List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Juan Quintela --- migration.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/migration.c b/migration.c index 8cacbc3..7206866 100644 --- a/migration.c +++ b/migration.c @@ -651,12 +651,6 @@ static bool migrate_fd_put_ready(MigrationState *s, uint64_t max_size) bool last_round = false; qemu_mutex_lock_iothread(); - if (s->state != MIG_STATE_ACTIVE) { - DPRINTF("put_ready returning because of non-active state\n"); - qemu_mutex_unlock_iothread(); - return false; - } - DPRINTF("iterate\n"); pending_size = qemu_savevm_state_pending(s->file, max_size); DPRINTF("pending size %lu max %lu\n", pending_size, max_size); @@ -723,9 +717,18 @@ static void *buffered_file_thread(void *opaque) while (true) { int64_t current_time = qemu_get_clock_ms(rt_clock); - if (s->migration_state->complete) { + qemu_mutex_lock_iothread(); + if (m->state != MIG_STATE_ACTIVE) { + DPRINTF("put_ready returning because of non-active state\n"); + qemu_mutex_unlock_iothread(); break; } + if (m->complete) { + qemu_mutex_unlock_iothread(); + break; + } + qemu_mutex_unlock_iothread(); + if (current_time >= initial_time + BUFFER_DELAY) { uint64_t transferred_bytes = s->bytes_xfer; uint64_t time_spent = current_time - initial_time; -- 1.7.11.7