migration: Move migrate_use_zero_copy_send() to options.c
authorJuan Quintela <quintela@redhat.com>
Wed, 1 Mar 2023 21:17:14 +0000 (22:17 +0100)
committerJuan Quintela <quintela@redhat.com>
Mon, 24 Apr 2023 13:01:46 +0000 (15:01 +0200)
Once that we are there, we rename the function to
migrate_zero_copy_send() to be consistent with all other capabilities.

We can remove the CONFIG_LINUX guard.  We already check that we can't
setup this capability in migrate_caps_check().

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
migration/migration.c
migration/migration.h
migration/multifd.c
migration/options.c
migration/options.h
migration/socket.c

index 77ceacc59fd6a8e618c4895dceb698f6826e782b..fbb61819ca792aa5cca0a6491e07ef500496c39b 100644 (file)
@@ -1609,7 +1609,7 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp)
     }
 
 #ifdef CONFIG_LINUX
-    if (migrate_use_zero_copy_send() &&
+    if (migrate_zero_copy_send() &&
         ((params->has_multifd_compression && params->multifd_compression) ||
          (params->tls_creds && *params->tls_creds))) {
         error_setg(errp,
@@ -2595,17 +2595,6 @@ int migrate_multifd_zstd_level(void)
     return s->parameters.multifd_zstd_level;
 }
 
-#ifdef CONFIG_LINUX
-bool migrate_use_zero_copy_send(void)
-{
-    MigrationState *s;
-
-    s = migrate_get_current();
-
-    return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND];
-}
-#endif
-
 int migrate_use_tls(void)
 {
     MigrationState *s;
index 49c0e13f4177e51ca2db96715a87b689e1cae6e5..c939f82d53ef24adb5df1dab9a2843f5cb877069 100644 (file)
@@ -454,11 +454,6 @@ MultiFDCompression migrate_multifd_compression(void);
 int migrate_multifd_zlib_level(void);
 int migrate_multifd_zstd_level(void);
 
-#ifdef CONFIG_LINUX
-bool migrate_use_zero_copy_send(void);
-#else
-#define migrate_use_zero_copy_send() (false)
-#endif
 int migrate_use_tls(void);
 int migrate_use_xbzrle(void);
 uint64_t migrate_xbzrle_cache_size(void);
index 68073281898b04fdd6b312d60e60036f12a7a32e..cce3ad6988ee7208aa80b4979a2d56248f4f533d 100644 (file)
@@ -25,7 +25,7 @@
 #include "trace.h"
 #include "multifd.h"
 #include "threadinfo.h"
-
+#include "options.h"
 #include "qemu/yank.h"
 #include "io/channel-socket.h"
 #include "yank_functions.h"
@@ -608,7 +608,7 @@ int multifd_send_sync_main(QEMUFile *f)
      * all the dirty bitmaps.
      */
 
-    flush_zero_copy = migrate_use_zero_copy_send();
+    flush_zero_copy = migrate_zero_copy_send();
 
     for (i = 0; i < migrate_multifd_channels(); i++) {
         MultiFDSendParams *p = &multifd_send_state->params[i];
@@ -653,7 +653,7 @@ static void *multifd_send_thread(void *opaque)
     MigrationThread *thread = NULL;
     Error *local_err = NULL;
     int ret = 0;
-    bool use_zero_copy_send = migrate_use_zero_copy_send();
+    bool use_zero_copy_send = migrate_zero_copy_send();
 
     thread = MigrationThreadAdd(p->name, qemu_get_thread_id());
 
@@ -945,7 +945,7 @@ int multifd_save_setup(Error **errp)
         p->page_size = qemu_target_page_size();
         p->page_count = page_count;
 
-        if (migrate_use_zero_copy_send()) {
+        if (migrate_zero_copy_send()) {
             p->write_flags = QIO_CHANNEL_WRITE_FLAG_ZERO_COPY;
         } else {
             p->write_flags = 0;
index 58673fc10115dea76992da9937604379b02019d7..f357c99996cb5f4b4d2ef17e6f559e34ba41698e 100644 (file)
@@ -155,3 +155,12 @@ bool migrate_zero_blocks(void)
 
     return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS];
 }
+
+bool migrate_zero_copy_send(void)
+{
+    MigrationState *s;
+
+    s = migrate_get_current();
+
+    return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND];
+}
index d07269ee38140cd354a491eac8372038178fb267..ad22f4d24aa47d949a6d3e31a7e3580f1eea2330 100644 (file)
@@ -32,5 +32,6 @@ bool migrate_postcopy_ram(void);
 bool migrate_release_ram(void);
 bool migrate_validate_uuid(void);
 bool migrate_zero_blocks(void);
+bool migrate_zero_copy_send(void);
 
 #endif
index f4835a256ab2b34b672b4c7511075f469b3b50e9..1b6f5baefbc36281c7f75d2ba2ecf7727743206d 100644 (file)
@@ -98,7 +98,7 @@ static void socket_outgoing_migration(QIOTask *task,
 
     trace_migration_socket_outgoing_connected(data->hostname);
 
-    if (migrate_use_zero_copy_send() &&
+    if (migrate_zero_copy_send() &&
         !qio_channel_has_feature(sioc, QIO_CHANNEL_FEATURE_WRITE_ZERO_COPY)) {
         error_setg(&err, "Zero copy send feature not detected in host kernel");
     }