From ebd88a49736f4e3af0aa4004ceb0980698659ebe Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Tue, 11 Oct 2022 17:55:54 -0400 Subject: migration: Add pss_init() Helper to init PSS structures. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'migration') diff --git a/migration/ram.c b/migration/ram.c index 571d780987..d81bf7b183 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -542,6 +542,14 @@ static bool do_compress_ram_page(QEMUFile *f, z_stream *stream, RAMBlock *block, static void postcopy_preempt_restore(RAMState *rs, PageSearchStatus *pss, bool postcopy_requested); +/* NOTE: page is the PFN not real ram_addr_t. */ +static void pss_init(PageSearchStatus *pss, RAMBlock *rb, ram_addr_t page) +{ + pss->block = rb; + pss->page = page; + pss->complete_round = false; +} + static void *do_data_compress(void *opaque) { CompressParam *param = opaque; @@ -2650,9 +2658,7 @@ static int ram_find_and_save_block(RAMState *rs) rs->last_page = 0; } - pss.block = rs->last_seen_block; - pss.page = rs->last_page; - pss.complete_round = false; + pss_init(&pss, rs->last_seen_block, rs->last_page); do { again = true; -- cgit v1.2.3