mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
migration/rdma: Simplify the function that saves a page
When we sent a page through QEMUFile hooks (RDMA) there are three posiblities: - We are not using RDMA. return RAM_SAVE_CONTROL_DELAYED and control_save_page() returns false to let anything else to proceed. - There is one error but we are using RDMA. Then we return a negative value, control_save_page() needs to return true. - Everything goes well and RDMA start the sent of the page asynchronously. It returns RAM_SAVE_CONTROL_DELAYED and we need to return 1 for ram_save_page_legacy. Clear? I know, I know, the interface is as bad as it gets. I think that now it is a bit clearer, but this needs to be done some other way. Reviewed-by: Leonardo Bras <leobras@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-Id: <20230515195709.63843-16-quintela@redhat.com>
This commit is contained in:
parent
9f51fe9239
commit
9c53d369e5
4 changed files with 18 additions and 37 deletions
|
@ -1186,23 +1186,19 @@ static int save_zero_page(PageSearchStatus *pss, QEMUFile *f, RAMBlock *block,
|
|||
static bool control_save_page(PageSearchStatus *pss, RAMBlock *block,
|
||||
ram_addr_t offset, int *pages)
|
||||
{
|
||||
uint64_t bytes_xmit = 0;
|
||||
int ret;
|
||||
|
||||
*pages = -1;
|
||||
ret = ram_control_save_page(pss->pss_channel, block->offset, offset,
|
||||
TARGET_PAGE_SIZE, &bytes_xmit);
|
||||
TARGET_PAGE_SIZE);
|
||||
if (ret == RAM_SAVE_CONTROL_NOT_SUPP) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bytes_xmit) {
|
||||
*pages = 1;
|
||||
}
|
||||
|
||||
if (ret == RAM_SAVE_CONTROL_DELAYED) {
|
||||
*pages = 1;
|
||||
return true;
|
||||
}
|
||||
*pages = ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue