[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/22] migration: Simplify ram_find_and_save_block()
From: |
Juan Quintela |
Subject: |
[PULL 06/22] migration: Simplify ram_find_and_save_block() |
Date: |
Mon, 13 Feb 2023 03:51:34 +0100 |
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>
---
migration/ram.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index b966e148c2..dd809fec1f 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2542,7 +2542,6 @@ static int ram_find_and_save_block(RAMState *rs)
{
PageSearchStatus *pss = &rs->pss[RAM_CHANNEL_PRECOPY];
int pages = 0;
- bool again, found;
/* No dirty page as there is zero RAM */
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);
do {
- again = true;
- found = get_queued_page(rs, pss);
-
- if (!found) {
+ if (!get_queued_page(rs, pss)) {
/* 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;
+ }
+ }
}
-
- if (found) {
- pages = ram_save_host_page(rs, pss);
- }
- } while (!pages && again);
+ pages = ram_save_host_page(rs, pss);
+ } while (!pages);
rs->last_seen_block = pss->block;
rs->last_page = pss->page;
--
2.39.1
- [PULL 21/22] migration/multifd: Move load_cleanup inside incoming_state_destroy, (continued)
- [PULL 21/22] migration/multifd: Move load_cleanup inside incoming_state_destroy, Xxx Xx, 2023/02/12
- [PULL 22/22] ram: Document migration ram flags, Xxx Xx, 2023/02/12
- [PULL 18/22] migration/multifd: Change multifd_load_cleanup() signature and usage, Xxx Xx, 2023/02/12
- Re: [PULL 00/22] Migration 20230213 patches, Juan Quintela, 2023/02/12
- [PULL 00/22] Migration 20230213 patches, Juan Quintela, 2023/02/12
- [PULL 02/22] multifd: cleanup the function multifd_channel_connect, Juan Quintela, 2023/02/12
- [PULL 01/22] migration: Remove spurious files, Juan Quintela, 2023/02/12
- [PULL 03/22] multifd: Remove some redundant code, Juan Quintela, 2023/02/12
- [PULL 04/22] linux-headers: Update to v6.1, Juan Quintela, 2023/02/12
- [PULL 05/22] util/userfaultfd: Support /dev/userfaultfd, Juan Quintela, 2023/02/12
- [PULL 06/22] migration: Simplify ram_find_and_save_block(),
Juan Quintela <=
- [PULL 07/22] migration: Make find_dirty_block() return a single parameter, Juan Quintela, 2023/02/12
- [PULL 08/22] migration: Split ram_bytes_total_common() in two functions, Juan Quintela, 2023/02/12
- [PULL 09/22] migration: Calculate ram size once, Juan Quintela, 2023/02/12
- [PULL 10/22] migration: Make ram_save_target_page() a pointer, Juan Quintela, 2023/02/12
- [PULL 14/22] migration: Rework multi-channel checks on URI, Juan Quintela, 2023/02/12
- [PULL 12/22] AVX512 support for xbzrle_encode_buffer, Juan Quintela, 2023/02/12
- [PULL 13/22] Update bench-code for addressing CI problem, Juan Quintela, 2023/02/12
- [PULL 15/22] migration: Cleanup postcopy_preempt_setup(), Juan Quintela, 2023/02/12
- [PULL 16/22] migration: Add a semaphore to count PONGs, Juan Quintela, 2023/02/12
- [PULL 17/22] migration: Postpone postcopy preempt channel to be after main, Juan Quintela, 2023/02/12