From: Juan Quintela Date: Thu, 19 Oct 2023 11:07:23 +0000 (+0200) Subject: migration: Merge flush_compressed_data() and compress_flush_data() X-Git-Tag: v8.2.0-rc0~43^2~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f639cfe515b159c86fbb6c7a10d2146ca1b99b23;p=thirdparty%2Fqemu.git migration: Merge flush_compressed_data() and compress_flush_data() Reviewed-by: Fabiano Rosas Signed-off-by: Juan Quintela Message-ID: <20231019110724.15324-11-quintela@redhat.com> --- diff --git a/migration/ram-compress.c b/migration/ram-compress.c index 1443a1cb458..036e44085b1 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); -} diff --git a/migration/ram-compress.h b/migration/ram-compress.h index 7ba01e2882f..e222887fb78 100644 --- a/migration/ram-compress.h +++ b/migration/ram-compress.h @@ -59,7 +59,6 @@ typedef struct CompressParam CompressParam; void compress_threads_save_cleanup(void); int compress_threads_save_setup(void); -void flush_compressed_data(int (send_queued_data(CompressParam *))); bool compress_page_with_multi_thread(RAMBlock *block, ram_addr_t offset, int (send_queued_data(CompressParam *)));