Patchwork [28/41] migration: use qemu_file_rate_limit consistently

login
register
mail settings
Submitter Paolo Bonzini
Date Feb. 15, 2013, 5:47 p.m.
Message ID <1360950433-17106-29-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/220827/
State New
Headers show

Comments

Paolo Bonzini - Feb. 15, 2013, 5:47 p.m.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 migration.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Orit Wasserman - Feb. 21, 2013, 7:34 a.m.
On 02/15/2013 07:47 PM, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  migration.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/migration.c b/migration.c
> index 3de7cbf..8d35af5 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -616,7 +616,7 @@ static void *migration_thread(void *opaque)
>          int64_t current_time = qemu_get_clock_ms(rt_clock);
>          uint64_t pending_size;
>  
> -        if (s->bytes_xfer < s->xfer_limit) {
> +        if (!qemu_file_rate_limit(s->file)) {
>              DPRINTF("iterate\n");
>              pending_size = qemu_savevm_state_pending(s->file, max_size);
>              DPRINTF("pending size %lu max %lu\n", pending_size, max_size);
> @@ -655,7 +655,7 @@ static void *migration_thread(void *opaque)
>              s->bytes_xfer = 0;
>              initial_time = current_time;
>          }
> -        if (s->bytes_xfer >= s->xfer_limit) {
> +        if (qemu_file_rate_limit(s->file)) {
>              /* usleep expects microseconds */
>              g_usleep((initial_time + BUFFER_DELAY - current_time)*1000);
>          }
> 
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Juan Quintela - Feb. 22, 2013, 11:17 a.m.
Paolo Bonzini <pbonzini@redhat.com> wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

Patch

diff --git a/migration.c b/migration.c
index 3de7cbf..8d35af5 100644
--- a/migration.c
+++ b/migration.c
@@ -616,7 +616,7 @@  static void *migration_thread(void *opaque)
         int64_t current_time = qemu_get_clock_ms(rt_clock);
         uint64_t pending_size;
 
-        if (s->bytes_xfer < s->xfer_limit) {
+        if (!qemu_file_rate_limit(s->file)) {
             DPRINTF("iterate\n");
             pending_size = qemu_savevm_state_pending(s->file, max_size);
             DPRINTF("pending size %lu max %lu\n", pending_size, max_size);
@@ -655,7 +655,7 @@  static void *migration_thread(void *opaque)
             s->bytes_xfer = 0;
             initial_time = current_time;
         }
-        if (s->bytes_xfer >= s->xfer_limit) {
+        if (qemu_file_rate_limit(s->file)) {
             /* usleep expects microseconds */
             g_usleep((initial_time + BUFFER_DELAY - current_time)*1000);
         }