@@ -1143,33 +1143,6 @@ static int save_zero_page(RAMState *rs, PageSearchStatus *pss,
return len;
}
-/*
- * @pages: the number of pages written by the control path,
- * < 0 - error
- * > 0 - number of pages written
- *
- * Return true if the pages has been saved, otherwise false is returned.
- */
-static bool control_save_page(PageSearchStatus *pss,
- ram_addr_t offset, int *pages)
-{
- int ret;
-
- if (migrate_rdma() && !migration_in_postcopy()) {
- ret = rdma_control_save_page(pss->pss_channel, pss->block->offset,
- offset, TARGET_PAGE_SIZE);
-
- if (ret == RAM_SAVE_CONTROL_DELAYED) {
- *pages = 1;
- } else {
- *pages = ret;
- }
- return true;
- }
-
- return false;
-}
-
/*
* directly send the page to the stream
*
@@ -1966,7 +1939,13 @@ static int ram_save_target_page(RAMState *rs, PageSearchStatus *pss)
int res;
/* Hand over to RDMA first */
- if (control_save_page(pss, offset, &res)) {
+ if (migrate_rdma() && !migration_in_postcopy()) {
+ res = rdma_control_save_page(pss->pss_channel, pss->block->offset,
+ offset, TARGET_PAGE_SIZE);
+
+ if (res == RAM_SAVE_CONTROL_DELAYED) {
+ res = 1;
+ }
return res;
}
Refactor the page saving logic by integrating the control_save_page() function directly into ram_save_target_page(). This change consolidates the RDMA migration decision-making process into a single function, enhancing clarity and maintainability. Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> --- migration/ram.c | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-)