[PATCH 05/10] migration/colo: Unwrap qemu_savevm_live_state()

Peter Xu posted 10 patches 3 days, 11 hours ago
Maintainers: Hailiang Zhang <zhanghailiang@xfusion.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Markus Armbruster <armbru@redhat.com>
[PATCH 05/10] migration/colo: Unwrap qemu_savevm_live_state()
Posted by Peter Xu 3 days, 11 hours ago
It's only used in COLO path and only contains two calls.  Unwrap the
function.  It paves way for further reduce special COLO paths on sync.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 migration/savevm.h | 1 -
 migration/colo.c   | 3 ++-
 migration/savevm.c | 7 -------
 3 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/migration/savevm.h b/migration/savevm.h
index 5d815af742..528607f09e 100644
--- a/migration/savevm.h
+++ b/migration/savevm.h
@@ -64,7 +64,6 @@ void qemu_savevm_send_postcopy_ram_discard(QEMUFile *f, const char *name,
                                            uint64_t *start_list,
                                            uint64_t *length_list);
 void qemu_savevm_send_colo_enable(QEMUFile *f);
-void qemu_savevm_live_state(QEMUFile *f);
 int qemu_save_device_state(QEMUFile *f);
 
 int qemu_loadvm_state(QEMUFile *f, Error **errp);
diff --git a/migration/colo.c b/migration/colo.c
index db783f6fa7..e05736ecf0 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -471,7 +471,8 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
      * TODO: We may need a timeout mechanism to prevent COLO process
      * to be blocked here.
      */
-    qemu_savevm_live_state(s->to_dst_file);
+    qemu_savevm_state_complete_precopy(s->to_dst_file, true);
+    qemu_put_byte(s->to_dst_file, QEMU_VM_EOF);
 
     qemu_fflush(fb);
 
diff --git a/migration/savevm.c b/migration/savevm.c
index f1cd8c913d..529cf310e0 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1854,13 +1854,6 @@ cleanup:
     return ret;
 }
 
-void qemu_savevm_live_state(QEMUFile *f)
-{
-    /* save QEMU_VM_SECTION_END section */
-    qemu_savevm_state_complete_precopy(f, true);
-    qemu_put_byte(f, QEMU_VM_EOF);
-}
-
 /* Is a save state entry iterable (e.g. RAM)? */
 static bool qemu_savevm_se_iterable(SaveStateEntry *se)
 {
-- 
2.50.1
Re: [PATCH 05/10] migration/colo: Unwrap qemu_savevm_live_state()
Posted by Fabiano Rosas 1 day, 20 hours ago
Peter Xu <peterx@redhat.com> writes:

> It's only used in COLO path and only contains two calls.  Unwrap the
> function.  It paves way for further reduce special COLO paths on sync.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  migration/savevm.h | 1 -
>  migration/colo.c   | 3 ++-
>  migration/savevm.c | 7 -------
>  3 files changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/migration/savevm.h b/migration/savevm.h
> index 5d815af742..528607f09e 100644
> --- a/migration/savevm.h
> +++ b/migration/savevm.h
> @@ -64,7 +64,6 @@ void qemu_savevm_send_postcopy_ram_discard(QEMUFile *f, const char *name,
>                                             uint64_t *start_list,
>                                             uint64_t *length_list);
>  void qemu_savevm_send_colo_enable(QEMUFile *f);
> -void qemu_savevm_live_state(QEMUFile *f);
>  int qemu_save_device_state(QEMUFile *f);
>  
>  int qemu_loadvm_state(QEMUFile *f, Error **errp);
> diff --git a/migration/colo.c b/migration/colo.c
> index db783f6fa7..e05736ecf0 100644
> --- a/migration/colo.c
> +++ b/migration/colo.c
> @@ -471,7 +471,8 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
>       * TODO: We may need a timeout mechanism to prevent COLO process
>       * to be blocked here.
>       */
> -    qemu_savevm_live_state(s->to_dst_file);
> +    qemu_savevm_state_complete_precopy(s->to_dst_file, true);

Could maybe drop this complete from the name eventually.

> +    qemu_put_byte(s->to_dst_file, QEMU_VM_EOF);
>  
>      qemu_fflush(fb);
>  
> diff --git a/migration/savevm.c b/migration/savevm.c
> index f1cd8c913d..529cf310e0 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1854,13 +1854,6 @@ cleanup:
>      return ret;
>  }
>  
> -void qemu_savevm_live_state(QEMUFile *f)
> -{
> -    /* save QEMU_VM_SECTION_END section */
> -    qemu_savevm_state_complete_precopy(f, true);
> -    qemu_put_byte(f, QEMU_VM_EOF);
> -}
> -
>  /* Is a save state entry iterable (e.g. RAM)? */
>  static bool qemu_savevm_se_iterable(SaveStateEntry *se)
>  {

Reviewed-by: Fabiano Rosas <farosas@suse.de>