migration/multifd: Standardize on multifd ops names
Add the multifd_ prefix to all functions and remove the useless docstrings. Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
parent
a0c78d815c
commit
6f848dac4a
@ -220,16 +220,6 @@ static void multifd_qpl_deinit(QplData *qpl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* multifd_qpl_send_setup: set up send side
|
|
||||||
*
|
|
||||||
* Set up the channel with QPL compression.
|
|
||||||
*
|
|
||||||
* Returns 0 on success or -1 on error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel being used
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int multifd_qpl_send_setup(MultiFDSendParams *p, Error **errp)
|
static int multifd_qpl_send_setup(MultiFDSendParams *p, Error **errp)
|
||||||
{
|
{
|
||||||
QplData *qpl;
|
QplData *qpl;
|
||||||
@ -251,14 +241,6 @@ static int multifd_qpl_send_setup(MultiFDSendParams *p, Error **errp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* multifd_qpl_send_cleanup: clean up send side
|
|
||||||
*
|
|
||||||
* Close the channel and free memory.
|
|
||||||
*
|
|
||||||
* @p: Params for the channel being used
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static void multifd_qpl_send_cleanup(MultiFDSendParams *p, Error **errp)
|
static void multifd_qpl_send_cleanup(MultiFDSendParams *p, Error **errp)
|
||||||
{
|
{
|
||||||
multifd_qpl_deinit(p->compress_data);
|
multifd_qpl_deinit(p->compress_data);
|
||||||
@ -487,17 +469,6 @@ static void multifd_qpl_compress_pages(MultiFDSendParams *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* multifd_qpl_send_prepare: prepare data to be able to send
|
|
||||||
*
|
|
||||||
* Create a compressed buffer with all the pages that we are going to
|
|
||||||
* send.
|
|
||||||
*
|
|
||||||
* Returns 0 on success or -1 on error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel being used
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int multifd_qpl_send_prepare(MultiFDSendParams *p, Error **errp)
|
static int multifd_qpl_send_prepare(MultiFDSendParams *p, Error **errp)
|
||||||
{
|
{
|
||||||
QplData *qpl = p->compress_data;
|
QplData *qpl = p->compress_data;
|
||||||
@ -523,16 +494,6 @@ out:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* multifd_qpl_recv_setup: set up receive side
|
|
||||||
*
|
|
||||||
* Create the compressed channel and buffer.
|
|
||||||
*
|
|
||||||
* Returns 0 on success or -1 on error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel being used
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int multifd_qpl_recv_setup(MultiFDRecvParams *p, Error **errp)
|
static int multifd_qpl_recv_setup(MultiFDRecvParams *p, Error **errp)
|
||||||
{
|
{
|
||||||
QplData *qpl;
|
QplData *qpl;
|
||||||
@ -547,13 +508,6 @@ static int multifd_qpl_recv_setup(MultiFDRecvParams *p, Error **errp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* multifd_qpl_recv_cleanup: set up receive side
|
|
||||||
*
|
|
||||||
* Close the channel and free memory.
|
|
||||||
*
|
|
||||||
* @p: Params for the channel being used
|
|
||||||
*/
|
|
||||||
static void multifd_qpl_recv_cleanup(MultiFDRecvParams *p)
|
static void multifd_qpl_recv_cleanup(MultiFDRecvParams *p)
|
||||||
{
|
{
|
||||||
multifd_qpl_deinit(p->compress_data);
|
multifd_qpl_deinit(p->compress_data);
|
||||||
@ -694,17 +648,6 @@ static int multifd_qpl_decompress_pages(MultiFDRecvParams *p, Error **errp)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* multifd_qpl_recv: read the data from the channel into actual pages
|
|
||||||
*
|
|
||||||
* Read the compressed buffer, and uncompress it into the actual
|
|
||||||
* pages.
|
|
||||||
*
|
|
||||||
* Returns 0 on success or -1 on error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel being used
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int multifd_qpl_recv(MultiFDRecvParams *p, Error **errp)
|
static int multifd_qpl_recv(MultiFDRecvParams *p, Error **errp)
|
||||||
{
|
{
|
||||||
QplData *qpl = p->compress_data;
|
QplData *qpl = p->compress_data;
|
||||||
|
@ -103,14 +103,6 @@ static void multifd_uadk_uninit_sess(struct wd_data *wd)
|
|||||||
g_free(wd);
|
g_free(wd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* multifd_uadk_send_setup: setup send side
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int multifd_uadk_send_setup(MultiFDSendParams *p, Error **errp)
|
static int multifd_uadk_send_setup(MultiFDSendParams *p, Error **errp)
|
||||||
{
|
{
|
||||||
struct wd_data *wd;
|
struct wd_data *wd;
|
||||||
@ -134,14 +126,6 @@ static int multifd_uadk_send_setup(MultiFDSendParams *p, Error **errp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* multifd_uadk_send_cleanup: cleanup send side
|
|
||||||
*
|
|
||||||
* Close the channel and return memory.
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static void multifd_uadk_send_cleanup(MultiFDSendParams *p, Error **errp)
|
static void multifd_uadk_send_cleanup(MultiFDSendParams *p, Error **errp)
|
||||||
{
|
{
|
||||||
struct wd_data *wd = p->compress_data;
|
struct wd_data *wd = p->compress_data;
|
||||||
@ -159,17 +143,6 @@ static inline void prepare_next_iov(MultiFDSendParams *p, void *base,
|
|||||||
p->iovs_num++;
|
p->iovs_num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* multifd_uadk_send_prepare: prepare data to be able to send
|
|
||||||
*
|
|
||||||
* Create a compressed buffer with all the pages that we are going to
|
|
||||||
* send.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int multifd_uadk_send_prepare(MultiFDSendParams *p, Error **errp)
|
static int multifd_uadk_send_prepare(MultiFDSendParams *p, Error **errp)
|
||||||
{
|
{
|
||||||
struct wd_data *uadk_data = p->compress_data;
|
struct wd_data *uadk_data = p->compress_data;
|
||||||
@ -229,16 +202,6 @@ out:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* multifd_uadk_recv_setup: setup receive side
|
|
||||||
*
|
|
||||||
* Create the compressed channel and buffer.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int multifd_uadk_recv_setup(MultiFDRecvParams *p, Error **errp)
|
static int multifd_uadk_recv_setup(MultiFDRecvParams *p, Error **errp)
|
||||||
{
|
{
|
||||||
struct wd_data *wd;
|
struct wd_data *wd;
|
||||||
@ -253,13 +216,6 @@ static int multifd_uadk_recv_setup(MultiFDRecvParams *p, Error **errp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* multifd_uadk_recv_cleanup: cleanup receive side
|
|
||||||
*
|
|
||||||
* Close the channel and return memory.
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
*/
|
|
||||||
static void multifd_uadk_recv_cleanup(MultiFDRecvParams *p)
|
static void multifd_uadk_recv_cleanup(MultiFDRecvParams *p)
|
||||||
{
|
{
|
||||||
struct wd_data *wd = p->compress_data;
|
struct wd_data *wd = p->compress_data;
|
||||||
@ -268,17 +224,6 @@ static void multifd_uadk_recv_cleanup(MultiFDRecvParams *p)
|
|||||||
p->compress_data = NULL;
|
p->compress_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* multifd_uadk_recv: read the data from the channel into actual pages
|
|
||||||
*
|
|
||||||
* Read the compressed buffer, and uncompress it into the actual
|
|
||||||
* pages.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int multifd_uadk_recv(MultiFDRecvParams *p, Error **errp)
|
static int multifd_uadk_recv(MultiFDRecvParams *p, Error **errp)
|
||||||
{
|
{
|
||||||
struct wd_data *uadk_data = p->compress_data;
|
struct wd_data *uadk_data = p->compress_data;
|
||||||
|
@ -34,17 +34,7 @@ struct zlib_data {
|
|||||||
|
|
||||||
/* Multifd zlib compression */
|
/* Multifd zlib compression */
|
||||||
|
|
||||||
/**
|
static int multifd_zlib_send_setup(MultiFDSendParams *p, Error **errp)
|
||||||
* zlib_send_setup: setup send side
|
|
||||||
*
|
|
||||||
* Setup each channel with zlib compression.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int zlib_send_setup(MultiFDSendParams *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;
|
||||||
@ -86,15 +76,7 @@ err_free_z:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static void multifd_zlib_send_cleanup(MultiFDSendParams *p, Error **errp)
|
||||||
* zlib_send_cleanup: cleanup send side
|
|
||||||
*
|
|
||||||
* Close the channel and return memory.
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static void zlib_send_cleanup(MultiFDSendParams *p, Error **errp)
|
|
||||||
{
|
{
|
||||||
struct zlib_data *z = p->compress_data;
|
struct zlib_data *z = p->compress_data;
|
||||||
|
|
||||||
@ -110,18 +92,7 @@ static void zlib_send_cleanup(MultiFDSendParams *p, Error **errp)
|
|||||||
p->iov = NULL;
|
p->iov = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static int multifd_zlib_send_prepare(MultiFDSendParams *p, Error **errp)
|
||||||
* zlib_send_prepare: prepare date to be able to send
|
|
||||||
*
|
|
||||||
* Create a compressed buffer with all the pages that we are going to
|
|
||||||
* send.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int zlib_send_prepare(MultiFDSendParams *p, Error **errp)
|
|
||||||
{
|
{
|
||||||
MultiFDPages_t *pages = &p->data->u.ram;
|
MultiFDPages_t *pages = &p->data->u.ram;
|
||||||
struct zlib_data *z = p->compress_data;
|
struct zlib_data *z = p->compress_data;
|
||||||
@ -189,17 +160,7 @@ out:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static int multifd_zlib_recv_setup(MultiFDRecvParams *p, Error **errp)
|
||||||
* zlib_recv_setup: setup receive side
|
|
||||||
*
|
|
||||||
* Create the compressed channel and buffer.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
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;
|
||||||
@ -225,14 +186,7 @@ static int zlib_recv_setup(MultiFDRecvParams *p, Error **errp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static void multifd_zlib_recv_cleanup(MultiFDRecvParams *p)
|
||||||
* zlib_recv_cleanup: setup receive side
|
|
||||||
*
|
|
||||||
* For no compression this function does nothing.
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
*/
|
|
||||||
static void zlib_recv_cleanup(MultiFDRecvParams *p)
|
|
||||||
{
|
{
|
||||||
struct zlib_data *z = p->compress_data;
|
struct zlib_data *z = p->compress_data;
|
||||||
|
|
||||||
@ -243,18 +197,7 @@ static void zlib_recv_cleanup(MultiFDRecvParams *p)
|
|||||||
p->compress_data = NULL;
|
p->compress_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static int multifd_zlib_recv(MultiFDRecvParams *p, Error **errp)
|
||||||
* zlib_recv: read the data from the channel into actual pages
|
|
||||||
*
|
|
||||||
* Read the compressed buffer, and uncompress it into the actual
|
|
||||||
* pages.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int zlib_recv(MultiFDRecvParams *p, Error **errp)
|
|
||||||
{
|
{
|
||||||
struct zlib_data *z = p->compress_data;
|
struct zlib_data *z = p->compress_data;
|
||||||
z_stream *zs = &z->zs;
|
z_stream *zs = &z->zs;
|
||||||
@ -335,12 +278,12 @@ static int zlib_recv(MultiFDRecvParams *p, Error **errp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static MultiFDMethods multifd_zlib_ops = {
|
static MultiFDMethods multifd_zlib_ops = {
|
||||||
.send_setup = zlib_send_setup,
|
.send_setup = multifd_zlib_send_setup,
|
||||||
.send_cleanup = zlib_send_cleanup,
|
.send_cleanup = multifd_zlib_send_cleanup,
|
||||||
.send_prepare = zlib_send_prepare,
|
.send_prepare = multifd_zlib_send_prepare,
|
||||||
.recv_setup = zlib_recv_setup,
|
.recv_setup = multifd_zlib_recv_setup,
|
||||||
.recv_cleanup = zlib_recv_cleanup,
|
.recv_cleanup = multifd_zlib_recv_cleanup,
|
||||||
.recv = zlib_recv
|
.recv = multifd_zlib_recv
|
||||||
};
|
};
|
||||||
|
|
||||||
static void multifd_zlib_register(void)
|
static void multifd_zlib_register(void)
|
||||||
|
@ -37,17 +37,7 @@ struct zstd_data {
|
|||||||
|
|
||||||
/* Multifd zstd compression */
|
/* Multifd zstd compression */
|
||||||
|
|
||||||
/**
|
static int multifd_zstd_send_setup(MultiFDSendParams *p, Error **errp)
|
||||||
* zstd_send_setup: setup send side
|
|
||||||
*
|
|
||||||
* Setup each channel with zstd compression.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
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;
|
||||||
@ -83,15 +73,7 @@ static int zstd_send_setup(MultiFDSendParams *p, Error **errp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static void multifd_zstd_send_cleanup(MultiFDSendParams *p, Error **errp)
|
||||||
* zstd_send_cleanup: cleanup send side
|
|
||||||
*
|
|
||||||
* Close the channel and return memory.
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static void zstd_send_cleanup(MultiFDSendParams *p, Error **errp)
|
|
||||||
{
|
{
|
||||||
struct zstd_data *z = p->compress_data;
|
struct zstd_data *z = p->compress_data;
|
||||||
|
|
||||||
@ -106,18 +88,7 @@ static void zstd_send_cleanup(MultiFDSendParams *p, Error **errp)
|
|||||||
p->iov = NULL;
|
p->iov = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static int multifd_zstd_send_prepare(MultiFDSendParams *p, Error **errp)
|
||||||
* zstd_send_prepare: prepare date to be able to send
|
|
||||||
*
|
|
||||||
* Create a compressed buffer with all the pages that we are going to
|
|
||||||
* send.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int zstd_send_prepare(MultiFDSendParams *p, Error **errp)
|
|
||||||
{
|
{
|
||||||
MultiFDPages_t *pages = &p->data->u.ram;
|
MultiFDPages_t *pages = &p->data->u.ram;
|
||||||
struct zstd_data *z = p->compress_data;
|
struct zstd_data *z = p->compress_data;
|
||||||
@ -176,17 +147,7 @@ out:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static int multifd_zstd_recv_setup(MultiFDRecvParams *p, Error **errp)
|
||||||
* zstd_recv_setup: setup receive side
|
|
||||||
*
|
|
||||||
* Create the compressed channel and buffer.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
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;
|
||||||
@ -220,14 +181,7 @@ static int zstd_recv_setup(MultiFDRecvParams *p, Error **errp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static void multifd_zstd_recv_cleanup(MultiFDRecvParams *p)
|
||||||
* zstd_recv_cleanup: setup receive side
|
|
||||||
*
|
|
||||||
* For no compression this function does nothing.
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
*/
|
|
||||||
static void zstd_recv_cleanup(MultiFDRecvParams *p)
|
|
||||||
{
|
{
|
||||||
struct zstd_data *z = p->compress_data;
|
struct zstd_data *z = p->compress_data;
|
||||||
|
|
||||||
@ -239,18 +193,7 @@ static void zstd_recv_cleanup(MultiFDRecvParams *p)
|
|||||||
p->compress_data = NULL;
|
p->compress_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static int multifd_zstd_recv(MultiFDRecvParams *p, Error **errp)
|
||||||
* zstd_recv: read the data from the channel into actual pages
|
|
||||||
*
|
|
||||||
* Read the compressed buffer, and uncompress it into the actual
|
|
||||||
* pages.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int zstd_recv(MultiFDRecvParams *p, Error **errp)
|
|
||||||
{
|
{
|
||||||
uint32_t in_size = p->next_packet_size;
|
uint32_t in_size = p->next_packet_size;
|
||||||
uint32_t out_size = 0;
|
uint32_t out_size = 0;
|
||||||
@ -323,12 +266,12 @@ static int zstd_recv(MultiFDRecvParams *p, Error **errp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static MultiFDMethods multifd_zstd_ops = {
|
static MultiFDMethods multifd_zstd_ops = {
|
||||||
.send_setup = zstd_send_setup,
|
.send_setup = multifd_zstd_send_setup,
|
||||||
.send_cleanup = zstd_send_cleanup,
|
.send_cleanup = multifd_zstd_send_cleanup,
|
||||||
.send_prepare = zstd_send_prepare,
|
.send_prepare = multifd_zstd_send_prepare,
|
||||||
.recv_setup = zstd_recv_setup,
|
.recv_setup = multifd_zstd_recv_setup,
|
||||||
.recv_cleanup = zstd_recv_cleanup,
|
.recv_cleanup = multifd_zstd_recv_cleanup,
|
||||||
.recv = zstd_recv
|
.recv = multifd_zstd_recv
|
||||||
};
|
};
|
||||||
|
|
||||||
static void multifd_zstd_register(void)
|
static void multifd_zstd_register(void)
|
||||||
|
@ -167,15 +167,7 @@ static void multifd_set_file_bitmap(MultiFDSendParams *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Multifd without compression */
|
static int multifd_nocomp_send_setup(MultiFDSendParams *p, Error **errp)
|
||||||
|
|
||||||
/**
|
|
||||||
* nocomp_send_setup: setup send side
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int nocomp_send_setup(MultiFDSendParams *p, Error **errp)
|
|
||||||
{
|
{
|
||||||
uint32_t page_count = multifd_ram_page_count();
|
uint32_t page_count = multifd_ram_page_count();
|
||||||
|
|
||||||
@ -193,15 +185,7 @@ static int nocomp_send_setup(MultiFDSendParams *p, Error **errp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static void multifd_nocomp_send_cleanup(MultiFDSendParams *p, Error **errp)
|
||||||
* nocomp_send_cleanup: cleanup send side
|
|
||||||
*
|
|
||||||
* For no compression this function does nothing.
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static void nocomp_send_cleanup(MultiFDSendParams *p, Error **errp)
|
|
||||||
{
|
{
|
||||||
g_free(p->iov);
|
g_free(p->iov);
|
||||||
p->iov = NULL;
|
p->iov = NULL;
|
||||||
@ -222,18 +206,7 @@ static void multifd_send_prepare_iovs(MultiFDSendParams *p)
|
|||||||
p->next_packet_size = pages->normal_num * page_size;
|
p->next_packet_size = pages->normal_num * page_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static int multifd_nocomp_send_prepare(MultiFDSendParams *p, Error **errp)
|
||||||
* nocomp_send_prepare: prepare date to be able to send
|
|
||||||
*
|
|
||||||
* For no compression we just have to calculate the size of the
|
|
||||||
* packet.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int nocomp_send_prepare(MultiFDSendParams *p, Error **errp)
|
|
||||||
{
|
{
|
||||||
bool use_zero_copy_send = migrate_zero_copy_send();
|
bool use_zero_copy_send = migrate_zero_copy_send();
|
||||||
int ret;
|
int ret;
|
||||||
@ -272,46 +245,19 @@ static int nocomp_send_prepare(MultiFDSendParams *p, Error **errp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static int multifd_nocomp_recv_setup(MultiFDRecvParams *p, Error **errp)
|
||||||
* nocomp_recv_setup: setup receive side
|
|
||||||
*
|
|
||||||
* For no compression this function does nothing.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int nocomp_recv_setup(MultiFDRecvParams *p, Error **errp)
|
|
||||||
{
|
{
|
||||||
p->iov = g_new0(struct iovec, multifd_ram_page_count());
|
p->iov = g_new0(struct iovec, multifd_ram_page_count());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static void multifd_nocomp_recv_cleanup(MultiFDRecvParams *p)
|
||||||
* nocomp_recv_cleanup: setup receive side
|
|
||||||
*
|
|
||||||
* For no compression this function does nothing.
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
*/
|
|
||||||
static void nocomp_recv_cleanup(MultiFDRecvParams *p)
|
|
||||||
{
|
{
|
||||||
g_free(p->iov);
|
g_free(p->iov);
|
||||||
p->iov = NULL;
|
p->iov = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static int multifd_nocomp_recv(MultiFDRecvParams *p, Error **errp)
|
||||||
* nocomp_recv: read the data from the channel
|
|
||||||
*
|
|
||||||
* For no compression we just need to read things into the correct place.
|
|
||||||
*
|
|
||||||
* Returns 0 for success or -1 for error
|
|
||||||
*
|
|
||||||
* @p: Params for the channel that we are using
|
|
||||||
* @errp: pointer to an error
|
|
||||||
*/
|
|
||||||
static int nocomp_recv(MultiFDRecvParams *p, Error **errp)
|
|
||||||
{
|
{
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
|
|
||||||
@ -342,12 +288,12 @@ static int nocomp_recv(MultiFDRecvParams *p, Error **errp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static MultiFDMethods multifd_nocomp_ops = {
|
static MultiFDMethods multifd_nocomp_ops = {
|
||||||
.send_setup = nocomp_send_setup,
|
.send_setup = multifd_nocomp_send_setup,
|
||||||
.send_cleanup = nocomp_send_cleanup,
|
.send_cleanup = multifd_nocomp_send_cleanup,
|
||||||
.send_prepare = nocomp_send_prepare,
|
.send_prepare = multifd_nocomp_send_prepare,
|
||||||
.recv_setup = nocomp_recv_setup,
|
.recv_setup = multifd_nocomp_recv_setup,
|
||||||
.recv_cleanup = nocomp_recv_cleanup,
|
.recv_cleanup = multifd_nocomp_recv_cleanup,
|
||||||
.recv = nocomp_recv
|
.recv = multifd_nocomp_recv
|
||||||
};
|
};
|
||||||
|
|
||||||
static MultiFDMethods *multifd_ops[MULTIFD_COMPRESSION__MAX] = {
|
static MultiFDMethods *multifd_ops[MULTIFD_COMPRESSION__MAX] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user