migration: Create populate_compress()
So we don't have to access compression_counters from outside ram-compress.c. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Lukas Straub <lukasstraub2@web.de> Message-ID: <20230613145757.10131-7-quintela@redhat.com>
This commit is contained in:
parent
809f188a1a
commit
6f60900573
@ -974,16 +974,7 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s)
|
||||
info->xbzrle_cache->overflow = xbzrle_counters.overflow;
|
||||
}
|
||||
|
||||
if (migrate_compress()) {
|
||||
info->compression = g_malloc0(sizeof(*info->compression));
|
||||
info->compression->pages = compression_counters.pages;
|
||||
info->compression->busy = compression_counters.busy;
|
||||
info->compression->busy_rate = compression_counters.busy_rate;
|
||||
info->compression->compressed_size =
|
||||
compression_counters.compressed_size;
|
||||
info->compression->compression_rate =
|
||||
compression_counters.compression_rate;
|
||||
}
|
||||
populate_compress(info);
|
||||
|
||||
if (cpu_throttle_active()) {
|
||||
info->has_cpu_throttle_percentage = true;
|
||||
|
@ -488,3 +488,16 @@ void decompress_data_with_multi_threads(QEMUFile *f, void *host, int len)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void populate_compress(MigrationInfo *info)
|
||||
{
|
||||
if (!migrate_compress()) {
|
||||
return;
|
||||
}
|
||||
info->compression = g_malloc0(sizeof(*info->compression));
|
||||
info->compression->pages = compression_counters.pages;
|
||||
info->compression->busy = compression_counters.busy;
|
||||
info->compression->busy_rate = compression_counters.busy_rate;
|
||||
info->compression->compressed_size = compression_counters.compressed_size;
|
||||
info->compression->compression_rate = compression_counters.compression_rate;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#define QEMU_MIGRATION_COMPRESS_H
|
||||
|
||||
#include "qemu-file.h"
|
||||
#include "qapi/qapi-types-migration.h"
|
||||
|
||||
enum CompressResult {
|
||||
RES_NONE = 0,
|
||||
@ -67,4 +68,6 @@ void compress_threads_load_cleanup(void);
|
||||
int compress_threads_load_setup(QEMUFile *f);
|
||||
void decompress_data_with_multi_threads(QEMUFile *f, void *host, int len);
|
||||
|
||||
void populate_compress(MigrationInfo *info);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user