diff options
| author | Yuan Liu <yuan1.liu@intel.com> | 2024-06-10 18:21:05 +0800 |
|---|---|---|
| committer | Fabiano Rosas <farosas@suse.de> | 2024-06-14 14:01:28 -0300 |
| commit | d9d3e4f243214f742425d9d8360f0794bb05c999 (patch) | |
| tree | 33897c1a18a34120f56d34c2cadd1da775f99832 /migration/multifd-zlib.c | |
| parent | 0d40b3d76ced77c1c82c77a636af703fabdb407c (diff) | |
| download | focaccia-qemu-d9d3e4f243214f742425d9d8360f0794bb05c999.tar.gz focaccia-qemu-d9d3e4f243214f742425d9d8360f0794bb05c999.zip | |
migration/multifd: put IOV initialization into compression method
Different compression methods may require different numbers of IOVs. Based on streaming compression of zlib and zstd, all pages will be compressed to a data block, so two IOVs are needed for packet header and compressed data block. Signed-off-by: Yuan Liu <yuan1.liu@intel.com> Reviewed-by: Nanhai Zou <nanhai.zou@intel.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
Diffstat (limited to 'migration/multifd-zlib.c')
| -rw-r--r-- | migration/multifd-zlib.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index 737a9645d2..2ced69487e 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -70,6 +70,10 @@ static int zlib_send_setup(MultiFDSendParams *p, Error **errp) goto err_free_zbuff; } p->compress_data = z; + + /* Needs 2 IOVs, one for packet header and one for compressed data */ + p->iov = g_new0(struct iovec, 2); + return 0; err_free_zbuff: @@ -101,6 +105,9 @@ static void zlib_send_cleanup(MultiFDSendParams *p, Error **errp) z->buf = NULL; g_free(p->compress_data); p->compress_data = NULL; + + g_free(p->iov); + p->iov = NULL; } /** |