Message ID | 1360950433-17106-2-git-send-email-pbonzini@redhat.com |
---|---|
State | New |
Headers | show |
On 02/15/2013 07:46 PM, Paolo Bonzini wrote: > Unify the goto around the loop, with the exit condition at the end of it. > Both can be expressed as "while (ret >= 0)". > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > --- > migration.c | 11 +---------- > 1 files changed, 1 insertions(+), 10 deletions(-) > > diff --git a/migration.c b/migration.c > index b1ebb01..5414060 100644 > --- a/migration.c > +++ b/migration.c > @@ -665,14 +665,9 @@ static void *buffered_file_thread(void *opaque) > qemu_mutex_lock_iothread(); > DPRINTF("beginning savevm\n"); > ret = qemu_savevm_state_begin(s->file, &s->params); > - if (ret < 0) { > - DPRINTF("failed, %d\n", ret); > - qemu_mutex_unlock_iothread(); > - goto out; > - } > qemu_mutex_unlock_iothread(); > > - while (true) { > + while (ret >= 0) { > int64_t current_time = qemu_get_clock_ms(rt_clock); > uint64_t pending_size; > > @@ -745,12 +740,8 @@ static void *buffered_file_thread(void *opaque) > g_usleep((initial_time + BUFFER_DELAY - current_time)*1000); > } > ret = buffered_flush(s); > - if (ret < 0) { > - break; > - } > } > > -out: > if (ret < 0) { > migrate_fd_error(s); > } > Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Paolo Bonzini <pbonzini@redhat.com> wrote: > Unify the goto around the loop, with the exit condition at the end of it. > Both can be expressed as "while (ret >= 0)". > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com>
diff --git a/migration.c b/migration.c index b1ebb01..5414060 100644 --- a/migration.c +++ b/migration.c @@ -665,14 +665,9 @@ static void *buffered_file_thread(void *opaque) qemu_mutex_lock_iothread(); DPRINTF("beginning savevm\n"); ret = qemu_savevm_state_begin(s->file, &s->params); - if (ret < 0) { - DPRINTF("failed, %d\n", ret); - qemu_mutex_unlock_iothread(); - goto out; - } qemu_mutex_unlock_iothread(); - while (true) { + while (ret >= 0) { int64_t current_time = qemu_get_clock_ms(rt_clock); uint64_t pending_size; @@ -745,12 +740,8 @@ static void *buffered_file_thread(void *opaque) g_usleep((initial_time + BUFFER_DELAY - current_time)*1000); } ret = buffered_flush(s); - if (ret < 0) { - break; - } } -out: if (ret < 0) { migrate_fd_error(s); }
Unify the goto around the loop, with the exit condition at the end of it. Both can be expressed as "while (ret >= 0)". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- migration.c | 11 +---------- 1 files changed, 1 insertions(+), 10 deletions(-)