Patchwork [17/22] migration: use global variable directly

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

Comments

Juan Quintela - Feb. 23, 2011, 12:44 a.m.
We are setting a pointer to a local variable in the previous line, just use
the global variable directly.  We remove the ->file test because it is already
done inside qemu_file_set_rate_limit() function.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
Yoshiaki Tamura - Feb. 23, 2011, 8:15 a.m.
2011/2/23 Juan Quintela <quintela@redhat.com>:
> We are setting a pointer to a local variable in the previous line, just use
> the global variable directly.  We remove the ->file test because it is already
> done inside qemu_file_set_rate_limit() function.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  migration.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/migration.c b/migration.c
> index d7dfe1e..accc6e4 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -451,7 +451,6 @@ int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data)
>  int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data)
>  {
>     int64_t d;
> -    MigrationState *s;
>
>     d = qdict_get_int(qdict, "value");
>     if (d < 0) {
> @@ -459,9 +458,8 @@ int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data)
>     }
>     max_throttle = d;
>
> -    s = current_migration;
> -    if (s && s->file) {
> -        qemu_file_set_rate_limit(s->file, max_throttle);
> +    if (current_migration) {
> +        qemu_file_set_rate_limit(current_migration->file, max_throttle);
>     }
>
>     return 0;

Looks good to me.

Yoshi

> --
> 1.7.4
>
>
>

Patch

diff --git a/migration.c b/migration.c
index d7dfe1e..accc6e4 100644
--- a/migration.c
+++ b/migration.c
@@ -451,7 +451,6 @@  int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data)
 int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     int64_t d;
-    MigrationState *s;

     d = qdict_get_int(qdict, "value");
     if (d < 0) {
@@ -459,9 +458,8 @@  int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data)
     }
     max_throttle = d;

-    s = current_migration;
-    if (s && s->file) {
-        qemu_file_set_rate_limit(s->file, max_throttle);
+    if (current_migration) {
+        qemu_file_set_rate_limit(current_migration->file, max_throttle);
     }

     return 0;