From patchwork Fri Feb 15 17:47:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 220802 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5E7C82C007A for ; Sat, 16 Feb 2013 05:41:36 +1100 (EST) Received: from localhost ([::1]:56315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6PPj-0008MV-4y for incoming@patchwork.ozlabs.org; Fri, 15 Feb 2013 12:49:35 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6PP2-0007UD-QF for qemu-devel@nongnu.org; Fri, 15 Feb 2013 12:49:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6PP0-0004Xp-Ne for qemu-devel@nongnu.org; Fri, 15 Feb 2013 12:48:52 -0500 Received: from mail-ve0-f169.google.com ([209.85.128.169]:64971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6PP0-0004Xd-JS for qemu-devel@nongnu.org; Fri, 15 Feb 2013 12:48:50 -0500 Received: by mail-ve0-f169.google.com with SMTP id 15so3288499vea.14 for ; Fri, 15 Feb 2013 09:48:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=evVf3yWMGg3dUzWknawGA/psBA3+pt7pyIot7kE8nZg=; b=vzSX/wAo3azp4Jg6RkVsGEWzwztW5nHrt+tmj8SSOdiuoshUUxcnQvAdNOnBEabvpw X5stjI6aPYbmjBOXbeRII1LaPuMl1YgkqDjiA2Oc8pvPXMC1rdWMbm3vgK+ZQDHZQYsm S1e2XqwMImG3hOtWfVj5bH2xMKb+wEzQSwNvU4D2XoMpsNLSpjT0JxHaAIzhtARorEFH BvfCGVib/mntXYaMthRfRnN6QM3aVjA9kgwEGI3gBNNTLtxcpqanlIx3hstz3nOcn4zc EW3auhALpuIq/5GQ7zPhOYU1I2ulnhI4whrn8aZz/QXT1VMkBklNHWOxWUZCBsqfci1S 6pHA== X-Received: by 10.58.240.107 with SMTP id vz11mr4433282vec.45.1360950530224; Fri, 15 Feb 2013 09:48:50 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-179-137.ip50.fastwebnet.it. [93.34.179.137]) by mx.google.com with ESMTPS id yu12sm65402142vec.6.2013.02.15.09.48.48 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 15 Feb 2013 09:48:49 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 15 Feb 2013 18:47:11 +0100 Message-Id: <1360950433-17106-40-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1360950433-17106-1-git-send-email-pbonzini@redhat.com> References: <1360950433-17106-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.128.169 Cc: owasserm@redhat.com, chegu_vinod@hp.com, quintela@redhat.com Subject: [Qemu-devel] [PATCH 39/41] migration: move contents of migration_close to migrate_fd_cleanup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org With this patch, the migration_file is not needed anymore. Signed-off-by: Paolo Bonzini Reviewed-by: Juan Quintela Reviewed-by: Orit Wasserman --- migration.c | 17 +++++++---------- 1 files changed, 7 insertions(+), 10 deletions(-) diff --git a/migration.c b/migration.c index 7c1671f..c9a5978 100644 --- a/migration.c +++ b/migration.c @@ -271,6 +271,12 @@ static void migrate_fd_cleanup(void *opaque) DPRINTF("closing file\n"); qemu_fclose(s->file); s->file = NULL; + + qemu_mutex_unlock_iothread(); + qemu_thread_join(&s->thread); + qemu_mutex_lock_iothread(); + + migrate_fd_close(s); } assert(s->migration_file == NULL); @@ -506,16 +512,7 @@ static int migration_put_buffer(void *opaque, const uint8_t *buf, static int migration_close(void *opaque) { - MigrationState *s = opaque; - - DPRINTF("closing\n"); - - qemu_mutex_unlock_iothread(); - qemu_thread_join(&s->thread); - qemu_mutex_lock_iothread(); - assert (s->state != MIG_STATE_ACTIVE); - - return migrate_fd_close(s); + return 0; } static int migration_get_fd(void *opaque)