[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/43] migration: Move migrate_use_compression() to options.c
From: |
Juan Quintela |
Subject: |
[PATCH 06/43] migration: Move migrate_use_compression() to options.c |
Date: |
Thu, 2 Mar 2023 17:33:33 +0100 |
Once that we are there, we rename the function to migrate_compress()
to be consistent with all other capabilities.
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 | 16 ++++++++--------
5 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/migration/migration.h b/migration/migration.h
index 1ac11fdba9..394728dd44 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -432,7 +432,6 @@ bool migrate_use_return_path(void);
uint64_t ram_get_total_transferred_pages(void);
-bool migrate_use_compression(void);
int migrate_compress_level(void);
int migrate_compress_threads(void);
int migrate_compress_wait_thread(void);
diff --git a/migration/options.h b/migration/options.h
index 5d2d4298cd..aa9c165c94 100644
--- a/migration/options.h
+++ b/migration/options.h
@@ -21,6 +21,7 @@
bool migrate_auto_converge(void);
bool migrate_background_snapshot(void);
bool migrate_colo(void);
+bool migrate_compress(void);
bool migrate_dirty_bitmaps(void);
bool migrate_ignore_shared(void);
bool migrate_late_block_activate(void);
diff --git a/migration/migration.c b/migration/migration.c
index 03884f2f73..661c7c33d8 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1131,7 +1131,7 @@ static void populate_ram_info(MigrationInfo *info,
MigrationState *s)
info->xbzrle_cache->overflow = xbzrle_counters.overflow;
}
- if (migrate_use_compression()) {
+ if (migrate_compress()) {
info->compression = g_malloc0(sizeof(*info->compression));
info->compression->pages = compression_counters.pages;
info->compression->busy = compression_counters.busy;
@@ -2520,15 +2520,6 @@ bool migrate_postcopy(void)
return migrate_postcopy_ram() || migrate_dirty_bitmaps();
}
-bool migrate_use_compression(void)
-{
- MigrationState *s;
-
- s = migrate_get_current();
-
- return s->capabilities[MIGRATION_CAPABILITY_COMPRESS];
-}
-
int migrate_compress_level(void)
{
MigrationState *s;
diff --git a/migration/options.c b/migration/options.c
index 6904d054a9..d1c44462c5 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -41,6 +41,15 @@ bool migrate_colo(void)
return s->capabilities[MIGRATION_CAPABILITY_X_COLO];
}
+bool migrate_compress(void)
+{
+ MigrationState *s;
+
+ s = migrate_get_current();
+
+ return s->capabilities[MIGRATION_CAPABILITY_COMPRESS];
+}
+
bool migrate_dirty_bitmaps(void)
{
MigrationState *s;
diff --git a/migration/ram.c b/migration/ram.c
index 1c786eb8f4..fb868312f4 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -591,7 +591,7 @@ static void compress_threads_save_cleanup(void)
{
int i, thread_count;
- if (!migrate_use_compression() || !comp_param) {
+ if (!migrate_compress() || !comp_param) {
return;
}
@@ -630,7 +630,7 @@ static int compress_threads_save_setup(void)
{
int i, thread_count;
- if (!migrate_use_compression()) {
+ if (!migrate_compress()) {
return 0;
}
thread_count = migrate_compress_threads();
@@ -1161,7 +1161,7 @@ static void migration_update_rates(RAMState *rs, int64_t
end_time)
rs->xbzrle_bytes_prev = xbzrle_counters.bytes;
}
- if (migrate_use_compression()) {
+ if (migrate_compress()) {
compression_counters.busy_rate = (double)(compression_counters.busy -
rs->compress_thread_busy_prev) / page_count;
rs->compress_thread_busy_prev = compression_counters.busy;
@@ -2276,7 +2276,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr_t
start, ram_addr_t len)
static bool save_page_use_compression(RAMState *rs)
{
- if (!migrate_use_compression()) {
+ if (!migrate_compress()) {
return false;
}
@@ -3739,7 +3739,7 @@ static int wait_for_decompress_done(void)
{
int idx, thread_count;
- if (!migrate_use_compression()) {
+ if (!migrate_compress()) {
return 0;
}
@@ -3758,7 +3758,7 @@ static void compress_threads_load_cleanup(void)
{
int i, thread_count;
- if (!migrate_use_compression()) {
+ if (!migrate_compress()) {
return;
}
thread_count = migrate_decompress_threads();
@@ -3799,7 +3799,7 @@ static int compress_threads_load_setup(QEMUFile *f)
{
int i, thread_count;
- if (!migrate_use_compression()) {
+ if (!migrate_compress()) {
return 0;
}
@@ -4265,7 +4265,7 @@ static int ram_load_precopy(QEMUFile *f)
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 = migration_incoming_postcopy_advised();
- if (!migrate_use_compression()) {
+ if (!migrate_compress()) {
invalid_flags |= RAM_SAVE_FLAG_COMPRESS_PAGE;
}
--
2.39.2
- [PATCH 00/43] Migration: Create options.c for capabilities/params/properties, Juan Quintela, 2023/03/02
- [PATCH 01/43] migration: rename enabled_capabilities to capabilities, Juan Quintela, 2023/03/02
- [PATCH 02/43] migration: Pass migrate_caps_check() the old and new caps, Juan Quintela, 2023/03/02
- [PATCH 03/43] migration: Create migration_cap_set(), Juan Quintela, 2023/03/02
- [PATCH 04/43] migration: create options.c, Juan Quintela, 2023/03/02
- [PATCH 06/43] migration: Move migrate_use_compression() to options.c,
Juan Quintela <=
- [PATCH 05/43] migration: Move migrate_colo_enabled() to options.c, Juan Quintela, 2023/03/02
- [PATCH 09/43] migration: Move migrate_use_zero_copy_send() to options.c, Juan Quintela, 2023/03/02
- [PATCH 08/43] migration: Move migrate_use_multifd() to options.c, Juan Quintela, 2023/03/02
- [PATCH 07/43] migration: Move migrate_use_events() to options.c, Juan Quintela, 2023/03/02
- [PATCH 10/43] migration: Move migrate_use_xbzrle() to options.c, Juan Quintela, 2023/03/02
- [PATCH 12/43] migration: Move migrate_use_return() to options.c, Juan Quintela, 2023/03/02
- [PATCH 11/43] migration: Move migrate_use_block() to options.c, Juan Quintela, 2023/03/02
- [PATCH 13/43] migration: Create migrate_rdma_pin_all() function, Juan Quintela, 2023/03/02
- [PATCH 15/43] migration: Move qmp_query_migrate_capabilities() to options.c, Juan Quintela, 2023/03/02
- [PATCH 14/43] migration: Move migrate_caps_check() to options.c, Juan Quintela, 2023/03/02