qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 10/43] migration: Move migrate_use_xbzrle() to options.c


From: Juan Quintela
Subject: [PATCH 10/43] migration: Move migrate_use_xbzrle() to options.c
Date: Thu, 2 Mar 2023 17:33:37 +0100

Once that we are there, we rename the function to migrate_xbzrle()
to be consistent with all other capabilities.
We change the type to return bool also for consistency.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/migration.h |  1 -
 migration/options.h   |  1 +
 migration/migration.c | 11 +----------
 migration/options.c   |  9 +++++++++
 migration/ram.c       | 10 +++++-----
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/migration/migration.h b/migration/migration.h
index 7b82913c62..13d5c7f149 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -416,7 +416,6 @@ int migrate_multifd_zlib_level(void);
 int migrate_multifd_zstd_level(void);
 
 int migrate_use_tls(void);
-int migrate_use_xbzrle(void);
 uint64_t migrate_xbzrle_cache_size(void);
 
 bool migrate_use_block(void);
diff --git a/migration/options.h b/migration/options.h
index 413ef29a2a..e4e7879f40 100644
--- a/migration/options.h
+++ b/migration/options.h
@@ -33,6 +33,7 @@ bool migrate_postcopy_preempt(void);
 bool migrate_postcopy_ram(void);
 bool migrate_release_ram(void);
 bool migrate_validate_uuid(void);
+bool migrate_xbzrle(void);
 bool migrate_zero_blocks(void);
 bool migrate_zero_copy_send(void);
 
diff --git a/migration/migration.c b/migration/migration.c
index 48cffab413..e1a8972c0b 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1120,7 +1120,7 @@ static void populate_ram_info(MigrationInfo *info, 
MigrationState *s)
     info->ram->downtime_bytes = ram_counters.downtime_bytes;
     info->ram->postcopy_bytes = stat64_get(&ram_counters.postcopy_bytes);
 
-    if (migrate_use_xbzrle()) {
+    if (migrate_xbzrle()) {
         info->xbzrle_cache = g_malloc0(sizeof(*info->xbzrle_cache));
         info->xbzrle_cache->cache_size = migrate_xbzrle_cache_size();
         info->xbzrle_cache->bytes = xbzrle_counters.bytes;
@@ -2602,15 +2602,6 @@ int migrate_use_tls(void)
     return s->parameters.tls_creds && *s->parameters.tls_creds;
 }
 
-int migrate_use_xbzrle(void)
-{
-    MigrationState *s;
-
-    s = migrate_get_current();
-
-    return s->capabilities[MIGRATION_CAPABILITY_XBZRLE];
-}
-
 uint64_t migrate_xbzrle_cache_size(void)
 {
     MigrationState *s;
diff --git a/migration/options.c b/migration/options.c
index 2e00609b7b..a5b1b1dfda 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -149,6 +149,15 @@ bool migrate_validate_uuid(void)
     return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID];
 }
 
+bool migrate_xbzrle(void)
+{
+    MigrationState *s;
+
+    s = migrate_get_current();
+
+    return s->capabilities[MIGRATION_CAPABILITY_XBZRLE];
+}
+
 bool migrate_zero_blocks(void)
 {
     MigrationState *s;
diff --git a/migration/ram.c b/migration/ram.c
index 59a624f59a..93c9d016c4 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -156,14 +156,14 @@ static struct {
 
 static void XBZRLE_cache_lock(void)
 {
-    if (migrate_use_xbzrle()) {
+    if (migrate_xbzrle()) {
         qemu_mutex_lock(&XBZRLE.lock);
     }
 }
 
 static void XBZRLE_cache_unlock(void)
 {
-    if (migrate_use_xbzrle()) {
+    if (migrate_xbzrle()) {
         qemu_mutex_unlock(&XBZRLE.lock);
     }
 }
@@ -1143,7 +1143,7 @@ static void migration_update_rates(RAMState *rs, int64_t 
end_time)
         return;
     }
 
-    if (migrate_use_xbzrle()) {
+    if (migrate_xbzrle()) {
         double encoded_size, unencoded_size;
 
         xbzrle_counters.cache_miss_rate = (double)(xbzrle_counters.cache_miss -
@@ -1632,7 +1632,7 @@ static int find_dirty_block(RAMState *rs, 
PageSearchStatus *pss)
             /* Flag that we've looped */
             pss->complete_round = true;
             /* After the first round, enable XBZRLE. */
-            if (migrate_use_xbzrle()) {
+            if (migrate_xbzrle()) {
                 rs->xbzrle_enabled = true;
             }
         }
@@ -2985,7 +2985,7 @@ static int xbzrle_init(void)
 {
     Error *local_err = NULL;
 
-    if (!migrate_use_xbzrle()) {
+    if (!migrate_xbzrle()) {
         return 0;
     }
 
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]