aboutsummaryrefslogtreecommitdiff
path: root/migration/ram-compress.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2023-10-19 13:07:23 +0200
committerJuan Quintela <quintela@redhat.com>2023-10-30 17:41:55 +0100
commitf639cfe515b159c86fbb6c7a10d2146ca1b99b23 (patch)
treee74b41f5dfa32cb39750e4a762c52bbdbbbc4eab /migration/ram-compress.c
parent8020bc9a77086d4beebaa1d6d9a862fcc66d854f (diff)
migration: Merge flush_compressed_data() and compress_flush_data()
Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-ID: <20231019110724.15324-11-quintela@redhat.com>
Diffstat (limited to 'migration/ram-compress.c')
-rw-r--r--migration/ram-compress.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/migration/ram-compress.c b/migration/ram-compress.c
index 1443a1cb45..036e44085b 100644
--- a/migration/ram-compress.c
+++ b/migration/ram-compress.c
@@ -241,10 +241,14 @@ static inline void compress_reset_result(CompressParam *param)
param->offset = 0;
}
-void flush_compressed_data(int (send_queued_data(CompressParam *)))
+void compress_flush_data(void)
{
int thread_count = migrate_compress_threads();
+ if (!migrate_compress()) {
+ return;
+ }
+
qemu_mutex_lock(&comp_done_lock);
for (int i = 0; i < thread_count; i++) {
while (!comp_param[i].done) {
@@ -257,7 +261,7 @@ void flush_compressed_data(int (send_queued_data(CompressParam *)))
qemu_mutex_lock(&comp_param[i].mutex);
if (!comp_param[i].quit) {
CompressParam *param = &comp_param[i];
- send_queued_data(param);
+ compress_send_queued_data(param);
assert(qemu_file_buffer_empty(param->file));
compress_reset_result(param);
}
@@ -558,12 +562,3 @@ void compress_update_rates(uint64_t page_count)
compression_counters.compressed_size;
}
}
-
-void compress_flush_data(void)
-{
- if (!migrate_compress()) {
- return;
- }
-
- flush_compressed_data(compress_send_queued_data);
-}