migration/multifd: Remove QEMUFile from where it is not needed

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/20240104142144.9680-3-farosas@suse.de
Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
Fabiano Rosas 2024-01-04 11:21:39 -03:00 committed by Peter Xu
parent dca1bc7f24
commit 9346fa1870
3 changed files with 15 additions and 16 deletions

View File

@ -390,7 +390,7 @@ struct {
* false.
*/
static int multifd_send_pages(QEMUFile *f)
static int multifd_send_pages(void)
{
int i;
static int next_channel;
@ -436,7 +436,7 @@ static int multifd_send_pages(QEMUFile *f)
return 1;
}
int multifd_queue_page(QEMUFile *f, RAMBlock *block, ram_addr_t offset)
int multifd_queue_page(RAMBlock *block, ram_addr_t offset)
{
MultiFDPages_t *pages = multifd_send_state->pages;
bool changed = false;
@ -456,12 +456,12 @@ int multifd_queue_page(QEMUFile *f, RAMBlock *block, ram_addr_t offset)
changed = true;
}
if (multifd_send_pages(f) < 0) {
if (multifd_send_pages() < 0) {
return -1;
}
if (changed) {
return multifd_queue_page(f, block, offset);
return multifd_queue_page(block, offset);
}
return 1;
@ -583,7 +583,7 @@ static int multifd_zero_copy_flush(QIOChannel *c)
return ret;
}
int multifd_send_sync_main(QEMUFile *f)
int multifd_send_sync_main(void)
{
int i;
bool flush_zero_copy;
@ -592,7 +592,7 @@ int multifd_send_sync_main(QEMUFile *f)
return 0;
}
if (multifd_send_state->pages->num) {
if (multifd_send_pages(f) < 0) {
if (multifd_send_pages() < 0) {
error_report("%s: multifd_send_pages fail", __func__);
return -1;
}

View File

@ -21,8 +21,8 @@ void multifd_load_shutdown(void);
bool multifd_recv_all_channels_created(void);
void multifd_recv_new_channel(QIOChannel *ioc, Error **errp);
void multifd_recv_sync_main(void);
int multifd_send_sync_main(QEMUFile *f);
int multifd_queue_page(QEMUFile *f, RAMBlock *block, ram_addr_t offset);
int multifd_send_sync_main(void);
int multifd_queue_page(RAMBlock *block, ram_addr_t offset);
/* Multifd Compression flags */
#define MULTIFD_FLAG_SYNC (1 << 0)

View File

@ -1250,10 +1250,9 @@ static int ram_save_page(RAMState *rs, PageSearchStatus *pss)
return pages;
}
static int ram_save_multifd_page(QEMUFile *file, RAMBlock *block,
ram_addr_t offset)
static int ram_save_multifd_page(RAMBlock *block, ram_addr_t offset)
{
if (multifd_queue_page(file, block, offset) < 0) {
if (multifd_queue_page(block, offset) < 0) {
return -1;
}
stat64_add(&mig_stats.normal_pages, 1);
@ -1336,7 +1335,7 @@ static int find_dirty_block(RAMState *rs, PageSearchStatus *pss)
if (migrate_multifd() &&
!migrate_multifd_flush_after_each_section()) {
QEMUFile *f = rs->pss[RAM_CHANNEL_PRECOPY].pss_channel;
int ret = multifd_send_sync_main(f);
int ret = multifd_send_sync_main();
if (ret < 0) {
return ret;
}
@ -2067,7 +2066,7 @@ static int ram_save_target_page_legacy(RAMState *rs, PageSearchStatus *pss)
* still see partially copied pages which is data corruption.
*/
if (migrate_multifd() && !migration_in_postcopy()) {
return ram_save_multifd_page(pss->pss_channel, block, offset);
return ram_save_multifd_page(block, offset);
}
return ram_save_page(rs, pss);
@ -2985,7 +2984,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
migration_ops->ram_save_target_page = ram_save_target_page_legacy;
bql_unlock();
ret = multifd_send_sync_main(f);
ret = multifd_send_sync_main();
bql_lock();
if (ret < 0) {
return ret;
@ -3109,7 +3108,7 @@ out:
if (ret >= 0
&& migration_is_setup_or_active(migrate_get_current()->state)) {
if (migrate_multifd() && migrate_multifd_flush_after_each_section()) {
ret = multifd_send_sync_main(rs->pss[RAM_CHANNEL_PRECOPY].pss_channel);
ret = multifd_send_sync_main();
if (ret < 0) {
return ret;
}
@ -3183,7 +3182,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
}
}
ret = multifd_send_sync_main(rs->pss[RAM_CHANNEL_PRECOPY].pss_channel);
ret = multifd_send_sync_main();
if (ret < 0) {
return ret;
}