From patchwork Wed Feb 23 21:47:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 84252 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AFE4EB70D4 for ; Thu, 24 Feb 2011 09:05:58 +1100 (EST) Received: from localhost ([127.0.0.1]:41111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsMpu-00083h-OP for incoming@patchwork.ozlabs.org; Wed, 23 Feb 2011 17:05:30 -0500 Received: from [140.186.70.92] (port=35520 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsMZ2-0000Ji-Jx for qemu-devel@nongnu.org; Wed, 23 Feb 2011 16:48:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsMYz-0005CN-FD for qemu-devel@nongnu.org; Wed, 23 Feb 2011 16:48:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35879) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsMYz-0005CF-3G for qemu-devel@nongnu.org; Wed, 23 Feb 2011 16:48:01 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1NLm0UK027989 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 23 Feb 2011 16:48:00 -0500 Received: from trasno.mitica (ovpn-113-97.phx2.redhat.com [10.3.113.97]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1NLlhC4020923; Wed, 23 Feb 2011 16:47:59 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 23 Feb 2011 22:47:21 +0100 Message-Id: <926fb06b01328d283f0a69877eeb8594f96120a0.1298492768.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 12/28] migration: Our release callback was just free X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: 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 9be6bb0..936b8f1 100644 --- a/migration.c +++ b/migration.c @@ -123,10 +123,7 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) goto free_migrate_state; } - if (current_migration) { - current_migration->release(current_migration); - } - + qemu_free(current_migration); current_migration = s; notifier_list_notify(&migration_state_notifiers); return 0; @@ -411,19 +408,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); - migrate_fd_cleanup(s); - } - qemu_free(s); -} - static void migrate_fd_wait_for_unfreeze(void *opaque) { MigrationState *s = opaque; @@ -501,7 +485,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 266c9f0..b90e344 100644 --- a/migration.h +++ b/migration.h @@ -40,7 +40,6 @@ struct MigrationState int (*write)(MigrationState *s, const void *buffer, size_t size); void (*cancel)(MigrationState *s); int (*get_status)(MigrationState *s); - void (*release)(MigrationState *s); void *opaque; int blk; int shared;