From: Peter Xu Date: Tue, 27 Jan 2026 18:52:47 +0000 (-0500) Subject: migration: qemu_savevm_state_complete_precopy() take MigrationState* X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09108805d56025d3a736ed047ff4f5ea98db3a2b;p=thirdparty%2Fqemu.git migration: qemu_savevm_state_complete_precopy() take MigrationState* 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 Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub Link: https://lore.kernel.org/qemu-devel/20260127185254.3954634-18-peterx@redhat.com Signed-off-by: Fabiano Rosas --- diff --git a/migration/migration.c b/migration/migration.c index b1d421953f..27e4456429 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2757,7 +2757,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) { 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,