diff options
author | Juan Quintela <quintela@redhat.com> | 2023-03-01 22:10:29 +0100 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2023-04-24 15:01:46 +0200 |
commit | 51b07548f7c31793adc178c7460c5f4369733c61 (patch) | |
tree | a8f6ddb879ade6d3d7b249e65d7372eeda54e29c | |
parent | b890902c9c025b87d02e718eec3090fd3525ab18 (diff) |
migration: Move migrate_use_multifd() to options.c
Once that we are there, we rename the function to migrate_multifd()
to be consistent with all other capabilities.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-rw-r--r-- | migration/migration.c | 19 | ||||
-rw-r--r-- | migration/migration.h | 1 | ||||
-rw-r--r-- | migration/multifd.c | 16 | ||||
-rw-r--r-- | migration/options.c | 9 | ||||
-rw-r--r-- | migration/options.h | 1 | ||||
-rw-r--r-- | migration/ram.c | 2 | ||||
-rw-r--r-- | migration/socket.c | 2 |
7 files changed, 25 insertions, 25 deletions
diff --git a/migration/migration.c b/migration/migration.c index 16800a624a..77ceacc59f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -186,7 +186,7 @@ static void migrate_fd_cancel(MigrationState *s); static bool migration_needs_multiple_sockets(void) { - return migrate_use_multifd() || migrate_postcopy_preempt(); + return migrate_multifd() || migrate_postcopy_preempt(); } static bool uri_supports_multi_channels(const char *uri) @@ -732,7 +732,7 @@ void migration_fd_process_incoming(QEMUFile *f, Error **errp) static bool migration_should_start_incoming(bool main_channel) { /* Multifd doesn't start unless all channels are established */ - if (migrate_use_multifd()) { + if (migrate_multifd()) { return migration_has_all_channels(); } @@ -759,7 +759,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp) uint32_t channel_magic = 0; int ret = 0; - if (migrate_use_multifd() && !migrate_postcopy_ram() && + if (migrate_multifd() && !migrate_postcopy_ram() && qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_READ_MSG_PEEK)) { /* * With multiple channels, it is possible that we receive channels @@ -798,7 +798,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp) } else { /* Multiple connections */ assert(migration_needs_multiple_sockets()); - if (migrate_use_multifd()) { + if (migrate_multifd()) { multifd_recv_new_channel(ioc, &local_err); } else { assert(migrate_postcopy_preempt()); @@ -834,7 +834,7 @@ bool migration_has_all_channels(void) return false; } - if (migrate_use_multifd()) { + if (migrate_multifd()) { return multifd_recv_all_channels_created(); } @@ -2558,15 +2558,6 @@ int migrate_decompress_threads(void) return s->parameters.decompress_threads; } -bool migrate_use_multifd(void) -{ - MigrationState *s; - - s = migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; -} - int migrate_multifd_channels(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index bd06520c19..49c0e13f41 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -449,7 +449,6 @@ MigrationState *migrate_get_current(void); bool migrate_postcopy(void); -bool migrate_use_multifd(void); int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); diff --git a/migration/multifd.c b/migration/multifd.c index 903df2117b..6807328189 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -516,7 +516,7 @@ void multifd_save_cleanup(void) { int i; - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return; } multifd_send_terminate_threads(NULL); @@ -587,7 +587,7 @@ int multifd_send_sync_main(QEMUFile *f) int i; bool flush_zero_copy; - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return 0; } if (multifd_send_state->pages->num) { @@ -911,7 +911,7 @@ int multifd_save_setup(Error **errp) uint32_t page_count = MULTIFD_PACKET_SIZE / qemu_target_page_size(); uint8_t i; - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return 0; } @@ -1016,7 +1016,7 @@ static void multifd_recv_terminate_threads(Error *err) void multifd_load_shutdown(void) { - if (migrate_use_multifd()) { + if (migrate_multifd()) { multifd_recv_terminate_threads(NULL); } } @@ -1025,7 +1025,7 @@ void multifd_load_cleanup(void) { int i; - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return; } multifd_recv_terminate_threads(NULL); @@ -1072,7 +1072,7 @@ void multifd_recv_sync_main(void) { int i; - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return; } for (i = 0; i < migrate_multifd_channels(); i++) { @@ -1170,7 +1170,7 @@ int multifd_load_setup(Error **errp) * Return successfully if multiFD recv state is already initialised * or multiFD is not enabled. */ - if (multifd_recv_state || !migrate_use_multifd()) { + if (multifd_recv_state || !migrate_multifd()) { return 0; } @@ -1216,7 +1216,7 @@ bool multifd_recv_all_channels_created(void) { int thread_count = migrate_multifd_channels(); - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return true; } diff --git a/migration/options.c b/migration/options.c index d2219ee0e4..58673fc101 100644 --- a/migration/options.c +++ b/migration/options.c @@ -84,6 +84,15 @@ bool migrate_late_block_activate(void) return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; } +bool migrate_multifd(void) +{ + MigrationState *s; + + s = migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; +} + bool migrate_pause_before_switchover(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index b998024eba..d07269ee38 100644 --- a/migration/options.h +++ b/migration/options.h @@ -24,6 +24,7 @@ bool migrate_dirty_bitmaps(void); bool migrate_events(void); bool migrate_ignore_shared(void); bool migrate_late_block_activate(void); +bool migrate_multifd(void); bool migrate_pause_before_switchover(void); bool migrate_postcopy_blocktime(void); bool migrate_postcopy_preempt(void); diff --git a/migration/ram.c b/migration/ram.c index ee454a3849..859dd7b63f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2362,7 +2362,7 @@ static int ram_save_target_page_legacy(RAMState *rs, PageSearchStatus *pss) * if host page size == guest page size the dest guest during run may * still see partially copied pages which is data corruption. */ - if (migrate_use_multifd() && !migration_in_postcopy()) { + if (migrate_multifd() && !migration_in_postcopy()) { return ram_save_multifd_page(pss->pss_channel, block, offset); } diff --git a/migration/socket.c b/migration/socket.c index ebf9ac41af..f4835a256a 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -183,7 +183,7 @@ socket_start_incoming_migration_internal(SocketAddress *saddr, qio_net_listener_set_name(listener, "migration-socket-listener"); - if (migrate_use_multifd()) { + if (migrate_multifd()) { num = migrate_multifd_channels(); } else if (migrate_postcopy_preempt()) { num = RAM_CHANNEL_MAX; |