[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 01/41] migration: simplify while loop
From: |
Orit Wasserman |
Subject: |
Re: [Qemu-devel] [PATCH 01/41] migration: simplify while loop |
Date: |
Mon, 18 Feb 2013 11:03:33 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
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 <address@hidden>
> ---
> 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 <address@hidden>