/* The empty QEMUFileOps will be used by file in CompressParam */
static const QEMUFileOps empty_ops = { };
-static bool compression_switch;
static DecompressParam *decomp_param;
static QemuThread *decompress_threads;
static QemuMutex decomp_done_lock;
if (!migrate_use_compression()) {
return;
}
- compression_switch = true;
thread_count = migrate_compress_threads();
compress_threads = g_new0(QemuThread, thread_count);
comp_param = g_new0(CompressParam, thread_count);
* point. In theory, xbzrle can do better than compression.
*/
flush_compressed_data(rs);
- compression_switch = false;
}
}
/* Didn't find anything this time, but try again on the new block */
/* Check the pages is dirty and if it is send it */
if (migration_bitmap_clear_dirty(rs, dirty_ram_abs)) {
unsigned long *unsentmap;
- if (compression_switch && migrate_use_compression()) {
+ /*
+ * If xbzrle is on, stop using the data compression after first
+ * round of migration even if compression is enabled. In theory,
+ * xbzrle can do better than compression.
+ */
+
+ if (migrate_use_compression()
+ && (rs->ram_bulk_stage || !migrate_use_xbzrle())) {
res = ram_save_compressed_page(rs, ms, pss, last_stage);
} else {
res = ram_save_page(rs, ms, pss, last_stage);