From patchwork Fri Sep 23 12:57:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 116078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 91526B6F80 for ; Fri, 23 Sep 2011 23:52:39 +1000 (EST) Received: from localhost ([::1]:49648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75Kx-0002kE-CU for incoming@patchwork.ozlabs.org; Fri, 23 Sep 2011 08:58:39 -0400 Received: from eggs.gnu.org ([140.186.70.92]:33754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75KM-0001HG-2V for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:58:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R75KF-0004qp-03 for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:57:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75KE-0004qc-MV for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:57:54 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8NCvr09020421 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 23 Sep 2011 08:57:53 -0400 Received: from neno.neno (ovpn-116-44.ams2.redhat.com [10.36.116.44]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8NCvZll021572; Fri, 23 Sep 2011 08:57:52 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Fri, 23 Sep 2011 14:57:00 +0200 Message-Id: <3f3e98d50099098b8cce57d781cdb9a42369164f.1316782367.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 11/23] migration: Our release callback was just free 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 We called it from a single place, and always with state != MIG_STATE_ACTIVE. Just remove the whole callback. For users of the notifier, notice that this is exactly the case where they don't care, we are just freeing the state from previous failed migration (it can't be a sucessful one, otherwise we would not be running on that machine in the first place). Signed-off-by: Juan Quintela --- migration.c | 19 +------------------ migration.h | 1 - 2 files changed, 1 insertions(+), 19 deletions(-) diff --git a/migration.c b/migration.c index 40fda7d..48c05b9 100644 --- a/migration.c +++ b/migration.c @@ -124,10 +124,7 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) goto free_migrate_state; } - if (current_migration) { - current_migration->release(current_migration); - } - + g_free(current_migration); current_migration = s; notifier_list_notify(&migration_state_notifiers, NULL); return 0; @@ -417,19 +414,6 @@ static void migrate_fd_cancel(MigrationState *s) migrate_fd_cleanup(s); } -static void migrate_fd_release(MigrationState *s) -{ - - DPRINTF("releasing state\n"); - - if (s->state == MIG_STATE_ACTIVE) { - s->state = MIG_STATE_CANCELLED; - notifier_list_notify(&migration_state_notifiers, NULL); - migrate_fd_cleanup(s); - } - g_free(s); -} - static void migrate_fd_wait_for_unfreeze(void *opaque) { MigrationState *s = opaque; @@ -513,7 +497,6 @@ static MigrationState *migrate_create_state(Monitor *mon, s->cancel = migrate_fd_cancel; s->get_status = migrate_fd_get_status; - s->release = migrate_fd_release; s->blk = blk; s->shared = inc; s->mon = NULL; diff --git a/migration.h b/migration.h index 8792655..9ea1ad6 100644 --- a/migration.h +++ b/migration.h @@ -40,7 +40,6 @@ struct MigrationState int (*write)(MigrationState *s, const void *buff, size_t size); void (*cancel)(MigrationState *s); int (*get_status)(MigrationState *s); - void (*release)(MigrationState *s); void *opaque; int blk; int shared;