summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2025-06-13 10:07:58 -0400
committerFabiano Rosas <farosas@suse.de>2025-07-11 10:37:36 -0300
commitff9dfc41d9e74651d565a3cad80dbaac3cde1eb9 (patch)
tree18560004dc2152220aa2bb65be736bb1f28903ac
parent7dd95a963072e0e33addbf2c87b548a624ce66b6 (diff)
downloadfocaccia-qemu-ff9dfc41d9e74651d565a3cad80dbaac3cde1eb9.tar.gz
focaccia-qemu-ff9dfc41d9e74651d565a3cad80dbaac3cde1eb9.zip
migration/ram: One less indent for ram_find_and_save_block()
The check over PAGE_DIRTY_FOUND isn't necessary. We could indent one less
and assert that instead.

Reviewed-by: Juraj Marcin <jmarcin@redhat.com>
Link: https://lore.kernel.org/r/20250613140801.474264-9-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
-rw-r--r--migration/ram.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/migration/ram.c b/migration/ram.c
index ffd839f57c..aa76f0a53f 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2286,16 +2286,18 @@ static int ram_find_and_save_block(RAMState *rs)
         if (!get_queued_page(rs, pss)) {
             /* priority queue empty, so just search for something dirty */
             int res = find_dirty_block(rs, pss);
-            if (res != PAGE_DIRTY_FOUND) {
-                if (res == PAGE_ALL_CLEAN) {
-                    break;
-                } else if (res == PAGE_TRY_AGAIN) {
-                    continue;
-                } else if (res < 0) {
-                    pages = res;
-                    break;
-                }
+
+            if (res == PAGE_ALL_CLEAN) {
+                break;
+            } else if (res == PAGE_TRY_AGAIN) {
+                continue;
+            } else if (res < 0) {
+                pages = res;
+                break;
             }
+
+            /* Otherwise we must have a dirty page to move */
+            assert(res == PAGE_DIRTY_FOUND);
         }
         pages = ram_save_host_page(rs, pss);
         if (pages) {