migration: Add pss_init()

Helper to init PSS structures.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
master
Peter Xu 2022-10-11 17:55:54 -04:00 committed by Juan Quintela
parent 61717ea9d2
commit ebd88a4973
1 changed files with 9 additions and 3 deletions

View File

@ -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;