diff mbox series

[13/18] migration: Simplify decompress_data_with_multi_threads()

Message ID 20230613145757.10131-14-quintela@redhat.com
State New
Headers show
Series Migration compression cleanup | expand

Commit Message

Juan Quintela June 13, 2023, 2:57 p.m. UTC
Doing a break to do another break is just confused.  Just call return
when we know we want to return.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/ram-compress.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Lukas Straub June 22, 2023, 11:47 a.m. UTC | #1
On Tue, 13 Jun 2023 16:57:52 +0200
Juan Quintela <quintela@redhat.com> wrote:

> Doing a break to do another break is just confused.  Just call return
> when we know we want to return.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Lukas Straub <lukasstraub2@web.de>

> ---
>  migration/ram-compress.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/migration/ram-compress.c b/migration/ram-compress.c
> index 5e1bb82fcd..cf3a6c238d 100644
> --- a/migration/ram-compress.c
> +++ b/migration/ram-compress.c
> @@ -498,14 +498,10 @@ void decompress_data_with_multi_threads(QEMUFile *f, void *host, int len)
>                  decomp_param[idx].len = len;
>                  qemu_cond_signal(&decomp_param[idx].cond);
>                  qemu_mutex_unlock(&decomp_param[idx].mutex);
> -                break;
> +                return;
>              }
>          }
> -        if (idx < thread_count) {
> -            break;
> -        } else {
> -            qemu_cond_wait(&decomp_done_cond, &decomp_done_lock);
> -        }
> +        qemu_cond_wait(&decomp_done_cond, &decomp_done_lock);
>      }
>  }
>
diff mbox series

Patch

diff --git a/migration/ram-compress.c b/migration/ram-compress.c
index 5e1bb82fcd..cf3a6c238d 100644
--- a/migration/ram-compress.c
+++ b/migration/ram-compress.c
@@ -498,14 +498,10 @@  void decompress_data_with_multi_threads(QEMUFile *f, void *host, int len)
                 decomp_param[idx].len = len;
                 qemu_cond_signal(&decomp_param[idx].cond);
                 qemu_mutex_unlock(&decomp_param[idx].mutex);
-                break;
+                return;
             }
         }
-        if (idx < thread_count) {
-            break;
-        } else {
-            qemu_cond_wait(&decomp_done_cond, &decomp_done_lock);
-        }
+        qemu_cond_wait(&decomp_done_cond, &decomp_done_lock);
     }
 }