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>
This commit is contained in:
Juan Quintela 2023-10-19 13:07:23 +02:00
parent 8020bc9a77
commit f639cfe515
2 changed files with 6 additions and 12 deletions

View File

@ -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);
}

View File

@ -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 *)));