migration/multifd: Rename MultiFDSend|RecvParams::data to compress_data

Use a more specific name for the compression data so we can use the
generic for the multifd core code.

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20240229153017.2221-13-farosas@suse.de
Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
Fabiano Rosas 2024-02-29 12:30:06 -03:00 committed by Peter Xu
parent c7076ec350
commit 402dd7ac1c
3 changed files with 22 additions and 22 deletions

View File

@ -69,7 +69,7 @@ static int zlib_send_setup(MultiFDSendParams *p, Error **errp)
err_msg = "out of memory for buf"; err_msg = "out of memory for buf";
goto err_free_zbuff; goto err_free_zbuff;
} }
p->data = z; p->compress_data = z;
return 0; return 0;
err_free_zbuff: err_free_zbuff:
@ -92,15 +92,15 @@ err_free_z:
*/ */
static void zlib_send_cleanup(MultiFDSendParams *p, Error **errp) static void zlib_send_cleanup(MultiFDSendParams *p, Error **errp)
{ {
struct zlib_data *z = p->data; struct zlib_data *z = p->compress_data;
deflateEnd(&z->zs); deflateEnd(&z->zs);
g_free(z->zbuff); g_free(z->zbuff);
z->zbuff = NULL; z->zbuff = NULL;
g_free(z->buf); g_free(z->buf);
z->buf = NULL; z->buf = NULL;
g_free(p->data); g_free(p->compress_data);
p->data = NULL; p->compress_data = NULL;
} }
/** /**
@ -117,7 +117,7 @@ static void zlib_send_cleanup(MultiFDSendParams *p, Error **errp)
static int zlib_send_prepare(MultiFDSendParams *p, Error **errp) static int zlib_send_prepare(MultiFDSendParams *p, Error **errp)
{ {
MultiFDPages_t *pages = p->pages; MultiFDPages_t *pages = p->pages;
struct zlib_data *z = p->data; struct zlib_data *z = p->compress_data;
z_stream *zs = &z->zs; z_stream *zs = &z->zs;
uint32_t out_size = 0; uint32_t out_size = 0;
int ret; int ret;
@ -194,7 +194,7 @@ static int zlib_recv_setup(MultiFDRecvParams *p, Error **errp)
struct zlib_data *z = g_new0(struct zlib_data, 1); struct zlib_data *z = g_new0(struct zlib_data, 1);
z_stream *zs = &z->zs; z_stream *zs = &z->zs;
p->data = z; p->compress_data = z;
zs->zalloc = Z_NULL; zs->zalloc = Z_NULL;
zs->zfree = Z_NULL; zs->zfree = Z_NULL;
zs->opaque = Z_NULL; zs->opaque = Z_NULL;
@ -224,13 +224,13 @@ static int zlib_recv_setup(MultiFDRecvParams *p, Error **errp)
*/ */
static void zlib_recv_cleanup(MultiFDRecvParams *p) static void zlib_recv_cleanup(MultiFDRecvParams *p)
{ {
struct zlib_data *z = p->data; struct zlib_data *z = p->compress_data;
inflateEnd(&z->zs); inflateEnd(&z->zs);
g_free(z->zbuff); g_free(z->zbuff);
z->zbuff = NULL; z->zbuff = NULL;
g_free(p->data); g_free(p->compress_data);
p->data = NULL; p->compress_data = NULL;
} }
/** /**
@ -246,7 +246,7 @@ static void zlib_recv_cleanup(MultiFDRecvParams *p)
*/ */
static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp) static int zlib_recv_pages(MultiFDRecvParams *p, Error **errp)
{ {
struct zlib_data *z = p->data; struct zlib_data *z = p->compress_data;
z_stream *zs = &z->zs; z_stream *zs = &z->zs;
uint32_t in_size = p->next_packet_size; uint32_t in_size = p->next_packet_size;
/* we measure the change of total_out */ /* we measure the change of total_out */

View File

@ -52,7 +52,7 @@ static int zstd_send_setup(MultiFDSendParams *p, Error **errp)
struct zstd_data *z = g_new0(struct zstd_data, 1); struct zstd_data *z = g_new0(struct zstd_data, 1);
int res; int res;
p->data = z; p->compress_data = z;
z->zcs = ZSTD_createCStream(); z->zcs = ZSTD_createCStream();
if (!z->zcs) { if (!z->zcs) {
g_free(z); g_free(z);
@ -90,14 +90,14 @@ static int zstd_send_setup(MultiFDSendParams *p, Error **errp)
*/ */
static void zstd_send_cleanup(MultiFDSendParams *p, Error **errp) static void zstd_send_cleanup(MultiFDSendParams *p, Error **errp)
{ {
struct zstd_data *z = p->data; struct zstd_data *z = p->compress_data;
ZSTD_freeCStream(z->zcs); ZSTD_freeCStream(z->zcs);
z->zcs = NULL; z->zcs = NULL;
g_free(z->zbuff); g_free(z->zbuff);
z->zbuff = NULL; z->zbuff = NULL;
g_free(p->data); g_free(p->compress_data);
p->data = NULL; p->compress_data = NULL;
} }
/** /**
@ -114,7 +114,7 @@ static void zstd_send_cleanup(MultiFDSendParams *p, Error **errp)
static int zstd_send_prepare(MultiFDSendParams *p, Error **errp) static int zstd_send_prepare(MultiFDSendParams *p, Error **errp)
{ {
MultiFDPages_t *pages = p->pages; MultiFDPages_t *pages = p->pages;
struct zstd_data *z = p->data; struct zstd_data *z = p->compress_data;
int ret; int ret;
uint32_t i; uint32_t i;
@ -183,7 +183,7 @@ static int zstd_recv_setup(MultiFDRecvParams *p, Error **errp)
struct zstd_data *z = g_new0(struct zstd_data, 1); struct zstd_data *z = g_new0(struct zstd_data, 1);
int ret; int ret;
p->data = z; p->compress_data = z;
z->zds = ZSTD_createDStream(); z->zds = ZSTD_createDStream();
if (!z->zds) { if (!z->zds) {
g_free(z); g_free(z);
@ -221,14 +221,14 @@ static int zstd_recv_setup(MultiFDRecvParams *p, Error **errp)
*/ */
static void zstd_recv_cleanup(MultiFDRecvParams *p) static void zstd_recv_cleanup(MultiFDRecvParams *p)
{ {
struct zstd_data *z = p->data; struct zstd_data *z = p->compress_data;
ZSTD_freeDStream(z->zds); ZSTD_freeDStream(z->zds);
z->zds = NULL; z->zds = NULL;
g_free(z->zbuff); g_free(z->zbuff);
z->zbuff = NULL; z->zbuff = NULL;
g_free(p->data); g_free(p->compress_data);
p->data = NULL; p->compress_data = NULL;
} }
/** /**
@ -248,7 +248,7 @@ static int zstd_recv_pages(MultiFDRecvParams *p, Error **errp)
uint32_t out_size = 0; uint32_t out_size = 0;
uint32_t expected_size = p->normal_num * p->page_size; uint32_t expected_size = p->normal_num * p->page_size;
uint32_t flags = p->flags & MULTIFD_FLAG_COMPRESSION_MASK; uint32_t flags = p->flags & MULTIFD_FLAG_COMPRESSION_MASK;
struct zstd_data *z = p->data; struct zstd_data *z = p->compress_data;
int ret; int ret;
int i; int i;

View File

@ -127,7 +127,7 @@ typedef struct {
/* number of iovs used */ /* number of iovs used */
uint32_t iovs_num; uint32_t iovs_num;
/* used for compression methods */ /* used for compression methods */
void *data; void *compress_data;
} MultiFDSendParams; } MultiFDSendParams;
typedef struct { typedef struct {
@ -183,7 +183,7 @@ typedef struct {
/* num of non zero pages */ /* num of non zero pages */
uint32_t normal_num; uint32_t normal_num;
/* used for de-compression methods */ /* used for de-compression methods */
void *data; void *compress_data;
} MultiFDRecvParams; } MultiFDRecvParams;
typedef struct { typedef struct {