diff mbox series

[v4,06/10] migration: process_incoming_migration_co: simplify code flow around ret

Message ID 20230428194928.1426370-7-vsementsov@yandex-team.ru
State New
Headers show
Series COLO: improve build options | expand

Commit Message

Vladimir Sementsov-Ogievskiy April 28, 2023, 7:49 p.m. UTC
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
 migration/migration.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Peter Xu May 2, 2023, 4:52 p.m. UTC | #1
On Fri, Apr 28, 2023 at 10:49:24PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>

Reviewed-by: Peter Xu <peterx@redhat.com>
Juan Quintela May 2, 2023, 6:20 p.m. UTC | #2
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> wrote:
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>

Reviewed-by: Juan Quintela <quintela@redhat.com>
Zhang, Chen May 4, 2023, 7:48 a.m. UTC | #3
> -----Original Message-----
> From: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> Sent: Saturday, April 29, 2023 3:49 AM
> To: qemu-devel@nongnu.org
> Cc: lukasstraub2@web.de; quintela@redhat.com; Zhang, Chen
> <chen.zhang@intel.com>; vsementsov@yandex-team.ru; Peter Xu
> <peterx@redhat.com>; Leonardo Bras <leobras@redhat.com>
> Subject: [PATCH v4 06/10] migration: process_incoming_migration_co:
> simplify code flow around ret
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>

Reviewed-by: Zhang Chen <chen.zhang@intel.com>

Thanks
Chen

> ---
>  migration/migration.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/migration/migration.c b/migration/migration.c index
> d4fa1a853c..8db0892317 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -533,8 +533,13 @@ process_incoming_migration_co(void *opaque)
>          /* Else if something went wrong then just fall out of the normal exit */
>      }
> 
> +    if (ret < 0) {
> +        error_report("load of migration failed: %s", strerror(-ret));
> +        goto fail;
> +    }
> +
>      /* we get COLO info, and know if we are in COLO mode */
> -    if (!ret && migration_incoming_colo_enabled()) {
> +    if (migration_incoming_colo_enabled()) {
>          QemuThread colo_incoming_thread;
> 
>          /* Make sure all file formats throw away their mutable metadata */
> @@ -556,10 +561,6 @@ process_incoming_migration_co(void *opaque)
>          colo_release_ram_cache();
>      }
> 
> -    if (ret < 0) {
> -        error_report("load of migration failed: %s", strerror(-ret));
> -        goto fail;
> -    }
>      mis->bh = qemu_bh_new(process_incoming_migration_bh, mis);
>      qemu_bh_schedule(mis->bh);
>      mis->migration_incoming_co = NULL;
> --
> 2.34.1
diff mbox series

Patch

diff --git a/migration/migration.c b/migration/migration.c
index d4fa1a853c..8db0892317 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -533,8 +533,13 @@  process_incoming_migration_co(void *opaque)
         /* Else if something went wrong then just fall out of the normal exit */
     }
 
+    if (ret < 0) {
+        error_report("load of migration failed: %s", strerror(-ret));
+        goto fail;
+    }
+
     /* we get COLO info, and know if we are in COLO mode */
-    if (!ret && migration_incoming_colo_enabled()) {
+    if (migration_incoming_colo_enabled()) {
         QemuThread colo_incoming_thread;
 
         /* Make sure all file formats throw away their mutable metadata */
@@ -556,10 +561,6 @@  process_incoming_migration_co(void *opaque)
         colo_release_ram_cache();
     }
 
-    if (ret < 0) {
-        error_report("load of migration failed: %s", strerror(-ret));
-        goto fail;
-    }
     mis->bh = qemu_bh_new(process_incoming_migration_bh, mis);
     qemu_bh_schedule(mis->bh);
     mis->migration_incoming_co = NULL;