Patchwork [23/41] buffered_file: We can access directly to bandwidth_limit

login
register
mail settings
Submitter Juan Quintela
Date Sept. 21, 2012, 8:47 a.m.
Message ID <1348217255-22441-24-git-send-email-quintela@redhat.com>
Download mbox | patch
Permalink /patch/185658/
State New
Headers show

Comments

Juan Quintela - Sept. 21, 2012, 8:47 a.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 buffered_file.c | 5 ++---
 buffered_file.h | 3 +--
 migration.c     | 2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)
Paolo Bonzini - Sept. 21, 2012, 12:35 p.m.
Il 21/09/2012 10:47, Juan Quintela ha scritto:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  buffered_file.c | 5 ++---
>  buffered_file.h | 3 +--
>  migration.c     | 2 +-
>  3 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/buffered_file.c b/buffered_file.c
> index 4fca774..43e68b6 100644
> --- a/buffered_file.c
> +++ b/buffered_file.c
> @@ -222,15 +222,14 @@ static void buffered_rate_tick(void *opaque)
>      buffered_put_buffer(s, NULL, 0, 0);
>  }
> 
> -QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state,
> -                                  size_t bytes_per_sec)
> +QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state)
>  {
>      QEMUFileBuffered *s;
> 
>      s = g_malloc0(sizeof(*s));
> 
>      s->migration_state = migration_state;
> -    s->xfer_limit = bytes_per_sec / 10;
> +    s->xfer_limit = migration_state->bandwidth_limit / 10;
> 
>      s->file = qemu_fopen_ops(s, buffered_put_buffer, NULL,
>                               buffered_close, buffered_rate_limit,
> diff --git a/buffered_file.h b/buffered_file.h
> index 8a38754..ef010fe 100644
> --- a/buffered_file.h
> +++ b/buffered_file.h
> @@ -17,7 +17,6 @@
>  #include "hw/hw.h"
>  #include "migration.h"
> 
> -QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state,
> -                                  size_t xfer_limit);
> +QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state);
> 
>  #endif
> diff --git a/migration.c b/migration.c
> index 6f1e4d3..56014dd 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -427,7 +427,7 @@ void migrate_fd_connect(MigrationState *s)
>      int ret;
> 
>      s->state = MIG_STATE_ACTIVE;
> -    s->file = qemu_fopen_ops_buffered(s, s->bandwidth_limit);
> +    s->file = qemu_fopen_ops_buffered(s);
> 
>      DPRINTF("beginning savevm\n");
>      ret = qemu_savevm_state_begin(s->file, &s->params);
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

Patch

diff --git a/buffered_file.c b/buffered_file.c
index 4fca774..43e68b6 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -222,15 +222,14 @@  static void buffered_rate_tick(void *opaque)
     buffered_put_buffer(s, NULL, 0, 0);
 }

-QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state,
-                                  size_t bytes_per_sec)
+QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state)
 {
     QEMUFileBuffered *s;

     s = g_malloc0(sizeof(*s));

     s->migration_state = migration_state;
-    s->xfer_limit = bytes_per_sec / 10;
+    s->xfer_limit = migration_state->bandwidth_limit / 10;

     s->file = qemu_fopen_ops(s, buffered_put_buffer, NULL,
                              buffered_close, buffered_rate_limit,
diff --git a/buffered_file.h b/buffered_file.h
index 8a38754..ef010fe 100644
--- a/buffered_file.h
+++ b/buffered_file.h
@@ -17,7 +17,6 @@ 
 #include "hw/hw.h"
 #include "migration.h"

-QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state,
-                                  size_t xfer_limit);
+QEMUFile *qemu_fopen_ops_buffered(MigrationState *migration_state);

 #endif
diff --git a/migration.c b/migration.c
index 6f1e4d3..56014dd 100644
--- a/migration.c
+++ b/migration.c
@@ -427,7 +427,7 @@  void migrate_fd_connect(MigrationState *s)
     int ret;

     s->state = MIG_STATE_ACTIVE;
-    s->file = qemu_fopen_ops_buffered(s, s->bandwidth_limit);
+    s->file = qemu_fopen_ops_buffered(s);

     DPRINTF("beginning savevm\n");
     ret = qemu_savevm_state_begin(s->file, &s->params);