aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2023-01-17 12:22:46 +0100
committerJuan Quintela <quintela@redhat.com>2023-02-06 19:22:56 +0100
commit80fe315c384153af957ee94d43d08b90ad1d5ef7 (patch)
treefee3d8aead49158a2420aa3626065f88cd3a8043 /migration
parent508f7988fd221f1f66c3f8a025c8a2dadac0af01 (diff)
migration/ram: Factor out check for advised postcopy
Let's factor out this check, to be used in virtio-mem context next. While at it, fix a spelling error in a related comment. Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com>S Signed-off-by: David Hildenbrand <david@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/migration.c7
-rw-r--r--migration/ram.c8
2 files changed, 8 insertions, 7 deletions
diff --git a/migration/migration.c b/migration/migration.c
index c3ad4cd670..f321e419c7 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2126,6 +2126,13 @@ bool migration_in_incoming_postcopy(void)
return ps >= POSTCOPY_INCOMING_DISCARD && ps < POSTCOPY_INCOMING_END;
}
+bool migration_incoming_postcopy_advised(void)
+{
+ PostcopyState ps = postcopy_state_get();
+
+ return ps >= POSTCOPY_INCOMING_ADVISE && ps < POSTCOPY_INCOMING_END;
+}
+
bool migration_in_bg_snapshot(void)
{
MigrationState *s = migrate_get_current();
diff --git a/migration/ram.c b/migration/ram.c
index 7f6d5efe8d..b966e148c2 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -4150,12 +4150,6 @@ int ram_load_postcopy(QEMUFile *f, int channel)
return ret;
}
-static bool postcopy_is_advised(void)
-{
- PostcopyState ps = postcopy_state_get();
- return ps >= POSTCOPY_INCOMING_ADVISE && ps < POSTCOPY_INCOMING_END;
-}
-
static bool postcopy_is_running(void)
{
PostcopyState ps = postcopy_state_get();
@@ -4226,7 +4220,7 @@ static int ram_load_precopy(QEMUFile *f)
MigrationIncomingState *mis = migration_incoming_get_current();
int flags = 0, ret = 0, invalid_flags = 0, len = 0, i = 0;
/* ADVISE is earlier, it shows the source has the postcopy capability on */
- bool postcopy_advised = postcopy_is_advised();
+ bool postcopy_advised = migration_incoming_postcopy_advised();
if (!migrate_use_compression()) {
invalid_flags |= RAM_SAVE_FLAG_COMPRESS_PAGE;
}