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