Peter Xu <[email protected]> writes:

> Make it pass in MigrationState* instead of s->to_dst_file, so as to drop
> the internal migrate_get_current().
>
> Signed-off-by: Peter Xu <[email protected]>
> ---
>  migration/savevm.h    | 2 +-
>  migration/migration.c | 2 +-
>  migration/savevm.c    | 7 ++++---
>  3 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/migration/savevm.h b/migration/savevm.h
> index 57b96133d5..bded5e2a6c 100644
> --- a/migration/savevm.h
> +++ b/migration/savevm.h
> @@ -42,7 +42,7 @@ void qemu_savevm_state_header(QEMUFile *f);
>  int qemu_savevm_state_iterate(QEMUFile *f, bool postcopy);
>  void qemu_savevm_state_cleanup(void);
>  void qemu_savevm_state_complete_postcopy(QEMUFile *f);
> -int qemu_savevm_state_complete_precopy(QEMUFile *f);
> +int qemu_savevm_state_complete_precopy(MigrationState *s);
>  void qemu_savevm_state_pending_exact(uint64_t *must_precopy,
>                                       uint64_t *can_postcopy);
>  void qemu_savevm_state_pending_estimate(uint64_t *must_precopy,
> diff --git a/migration/migration.c b/migration/migration.c
> index c6e54d2a3f..b8c85496f8 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2752,7 +2752,7 @@ static int migration_completion_precopy(MigrationState 
> *s)
>          goto out_unlock;
>      }
>  
> -    ret = qemu_savevm_state_complete_precopy(s->to_dst_file);
> +    ret = qemu_savevm_state_complete_precopy(s);
>  out_unlock:
>      bql_unlock();
>      return ret;
> diff --git a/migration/savevm.c b/migration/savevm.c
> index e1918d4f38..830d8e5988 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1728,8 +1728,9 @@ int qemu_savevm_state_non_iterable(QEMUFile *f)
>      return 0;
>  }
>  
> -int qemu_savevm_state_complete_precopy(QEMUFile *f)
> +int qemu_savevm_state_complete_precopy(MigrationState *s)
>  {
> +    QEMUFile *f = s->to_dst_file;
>      int ret;
>  
>      ret = qemu_savevm_state_complete_precopy_iterable(f, false);
> @@ -1742,7 +1743,7 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f)
>          return ret;
>      }
>  
> -    qemu_savevm_state_end_precopy(migrate_get_current(), f);
> +    qemu_savevm_state_end_precopy(s, f);
>  
>      return qemu_fflush(f);
>  }
> @@ -1841,7 +1842,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
>  
>      ret = qemu_file_get_error(f);
>      if (ret == 0) {
> -        qemu_savevm_state_complete_precopy(f);
> +        qemu_savevm_state_complete_precopy(ms);
>          ret = qemu_file_get_error(f);
>      }
>      if (ret != 0) {

Reviewed-by: Fabiano Rosas <[email protected]>

Reply via email to