mirror of https://github.com/xemu-project/xemu.git
migration: Simplify ram_find_and_save_block()
We will need later that find_dirty_block() return errors, so simplify the loop. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
c40c046341
commit
51efd36faf
|
@ -2542,7 +2542,6 @@ static int ram_find_and_save_block(RAMState *rs)
|
||||||
{
|
{
|
||||||
PageSearchStatus *pss = &rs->pss[RAM_CHANNEL_PRECOPY];
|
PageSearchStatus *pss = &rs->pss[RAM_CHANNEL_PRECOPY];
|
||||||
int pages = 0;
|
int pages = 0;
|
||||||
bool again, found;
|
|
||||||
|
|
||||||
/* No dirty page as there is zero RAM */
|
/* No dirty page as there is zero RAM */
|
||||||
if (!ram_bytes_total()) {
|
if (!ram_bytes_total()) {
|
||||||
|
@ -2564,18 +2563,17 @@ static int ram_find_and_save_block(RAMState *rs)
|
||||||
pss_init(pss, rs->last_seen_block, rs->last_page);
|
pss_init(pss, rs->last_seen_block, rs->last_page);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
again = true;
|
if (!get_queued_page(rs, pss)) {
|
||||||
found = get_queued_page(rs, pss);
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
/* priority queue empty, so just search for something dirty */
|
/* priority queue empty, so just search for something dirty */
|
||||||
found = find_dirty_block(rs, pss, &again);
|
bool again = true;
|
||||||
|
if (!find_dirty_block(rs, pss, &again)) {
|
||||||
|
if (!again) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pages = ram_save_host_page(rs, pss);
|
||||||
if (found) {
|
} while (!pages);
|
||||||
pages = ram_save_host_page(rs, pss);
|
|
||||||
}
|
|
||||||
} while (!pages && again);
|
|
||||||
|
|
||||||
rs->last_seen_block = pss->block;
|
rs->last_seen_block = pss->block;
|
||||||
rs->last_page = pss->page;
|
rs->last_page = pss->page;
|
||||||
|
|
Loading…
Reference in New Issue