[PATCH v3 05/25] migration: Move postcopy_try_recover into migration_incoming_process

Fabiano Rosas posted 25 patches 1 month ago
Maintainers: Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Mark Kanda <mark.kanda@oracle.com>, Ben Chaney <bchaney@akamai.com>, Li Zhijian <lizhijian@fujitsu.com>
There is a newer version of this series
[PATCH v3 05/25] migration: Move postcopy_try_recover into migration_incoming_process
Posted by Fabiano Rosas 1 month ago
The postcopy_try_recover() call doesn't need to be duplicated, move it
into migration_incoming_process().

This removes code from migration_fd_process_incoming() so it can be
removed in the near future.

(the diff is a bit strange because migration_incoming_process() was
moved after postcopy_try_recover())

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 migration/migration.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/migration/migration.c b/migration/migration.c
index c45393f40e..4af5baad59 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -943,12 +943,6 @@ static void migration_incoming_setup(QEMUFile *f)
     qemu_file_set_blocking(f, false, &error_abort);
 }
 
-void migration_incoming_process(void)
-{
-    Coroutine *co = qemu_coroutine_create(process_incoming_migration_co, NULL);
-    qemu_coroutine_enter(co);
-}
-
 /* Returns true if recovered from a paused migration, otherwise false */
 static bool postcopy_try_recover(void)
 {
@@ -982,12 +976,19 @@ static bool postcopy_try_recover(void)
     return false;
 }
 
+void migration_incoming_process(void)
+{
+    if (postcopy_try_recover()) {
+        return;
+    }
+
+    Coroutine *co = qemu_coroutine_create(process_incoming_migration_co, NULL);
+    qemu_coroutine_enter(co);
+}
+
 void migration_fd_process_incoming(QEMUFile *f)
 {
     migration_incoming_setup(f);
-    if (postcopy_try_recover()) {
-        return;
-    }
     migration_incoming_process();
 }
 
@@ -1087,10 +1088,6 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp)
     }
 
     if (migration_has_main_and_multifd_channels()) {
-        /* If it's a recovery, we're done */
-        if (postcopy_try_recover()) {
-            return;
-        }
         migration_incoming_process();
     }
 }
-- 
2.51.0
Re: [PATCH v3 05/25] migration: Move postcopy_try_recover into migration_incoming_process
Posted by Prasad Pandit 3 weeks ago
On Fri, 9 Jan 2026 at 18:12, Fabiano Rosas <farosas@suse.de> wrote:
> (the diff is a bit strange because migration_incoming_process() was
> moved after postcopy_try_recover())

* This note could be removed from the commit message.

> Reviewed-by: Peter Xu <peterx@redhat.com>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>  migration/migration.c | 23 ++++++++++-------------
>  1 file changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index c45393f40e..4af5baad59 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -943,12 +943,6 @@ static void migration_incoming_setup(QEMUFile *f)
>      qemu_file_set_blocking(f, false, &error_abort);
>  }
>
> -void migration_incoming_process(void)
> -{
> -    Coroutine *co = qemu_coroutine_create(process_incoming_migration_co, NULL);
> -    qemu_coroutine_enter(co);
> -}
> -
>  /* Returns true if recovered from a paused migration, otherwise false */
>  static bool postcopy_try_recover(void)
>  {
> @@ -982,12 +976,19 @@ static bool postcopy_try_recover(void)
>      return false;
>  }
>
> +void migration_incoming_process(void)
> +{
> +    if (postcopy_try_recover()) {
> +        return;
> +    }
> +
> +    Coroutine *co = qemu_coroutine_create(process_incoming_migration_co, NULL);
> +    qemu_coroutine_enter(co);
> +}
> +
>  void migration_fd_process_incoming(QEMUFile *f)
>  {
>      migration_incoming_setup(f);
> -    if (postcopy_try_recover()) {
> -        return;
> -    }
>      migration_incoming_process();
>  }
>
> @@ -1087,10 +1088,6 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp)
>      }
>
>      if (migration_has_main_and_multifd_channels()) {
> -        /* If it's a recovery, we're done */
> -        if (postcopy_try_recover()) {
> -            return;
> -        }
>          migration_incoming_process();
>      }
>  }
> --

* Looks right.
Reviewed-by: Prasad Pandit <pjp@fedoraproject.org>

Thank you.
---
  - Prasad