Patchwork [13/22] migration: Our release callback was just free

login
register
mail settings
Submitter Juan Quintela
Date Feb. 23, 2011, 12:44 a.m.
Message ID <c523f3c4763027669a4d490a7a6b3a04b9b511a6.1298421307.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/84029/
State New
Headers show

Comments

Juan Quintela - Feb. 23, 2011, 12:44 a.m.
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 <quintela@redhat.com>
---
 migration.c |   19 +------------------
 migration.h |    1 -
 2 files changed, 1 insertions(+), 19 deletions(-)

Patch

diff --git a/migration.c b/migration.c
index 3983257..dfe6a96 100644
--- a/migration.c
+++ b/migration.c
@@ -122,10 +122,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;
@@ -405,19 +402,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;
@@ -494,7 +478,6 @@  static MigrationState *migrate_create_state(Monitor *mon, int64_t bandwidth_limi

     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 3df2293..5455d8b 100644
--- a/migration.h
+++ b/migration.h
@@ -38,7 +38,6 @@  struct MigrationState
     int (*write)(MigrationState*, const void *, size_t);
     void (*cancel)(MigrationState *s);
     int (*get_status)(MigrationState *s);
-    void (*release)(MigrationState *s);
     void *opaque;
     int blk;
     int shared;