Blame SOURCES/kvm-migration-move-calling-control_save_page-to-the-comm.patch

383d26
From 5233d49067a64ecb2c6ab2c91f4345a254f832f2 Mon Sep 17 00:00:00 2001
383d26
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
383d26
Date: Fri, 22 Jun 2018 18:59:54 +0200
383d26
Subject: [PATCH 15/57] migration: move calling control_save_page to the common
383d26
 place
383d26
383d26
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
383d26
Message-id: <20180622190005.21297-8-dgilbert@redhat.com>
383d26
Patchwork-id: 81000
383d26
O-Subject: [RHEL7.6 qemu-kvm-rhev PATCH 07/18] migration: move calling control_save_page to the common place
383d26
Bugzilla: 1584139
383d26
RH-Acked-by: Peter Xu <peterx@redhat.com>
383d26
RH-Acked-by: Juan Quintela <quintela@redhat.com>
383d26
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
383d26
383d26
From: Xiao Guangrong <xiaoguangrong@tencent.com>
383d26
383d26
The function is called by both ram_save_page and ram_save_target_page,
383d26
so move it to the common caller to cleanup the code
383d26
383d26
Reviewed-by: Peter Xu <peterx@redhat.com>
383d26
Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
383d26
Message-Id: <20180330075128.26919-8-xiaoguangrong@tencent.com>
383d26
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
383d26
(cherry picked from commit a8ec91f941c5f83123796331c09333d3557eb5fc)
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 migration/ram.c | 16 ++++++++--------
383d26
 1 file changed, 8 insertions(+), 8 deletions(-)
383d26
383d26
diff --git a/migration/ram.c b/migration/ram.c
383d26
index 106fcf1..9d6c41c 100644
383d26
--- a/migration/ram.c
383d26
+++ b/migration/ram.c
383d26
@@ -1038,10 +1038,6 @@ static int ram_save_page(RAMState *rs, PageSearchStatus *pss, bool last_stage)
383d26
     p = block->host + offset;
383d26
     trace_ram_save_page(block->idstr, (uint64_t)offset, p);
383d26
 
383d26
-    if (control_save_page(rs, block, offset, &pages)) {
383d26
-        return pages;
383d26
-    }
383d26
-
383d26
     XBZRLE_cache_lock();
383d26
     pages = save_zero_page(rs, block, offset);
383d26
     if (pages > 0) {
383d26
@@ -1199,10 +1195,6 @@ static int ram_save_compressed_page(RAMState *rs, PageSearchStatus *pss,
383d26
 
383d26
     p = block->host + offset;
383d26
 
383d26
-    if (control_save_page(rs, block, offset, &pages)) {
383d26
-        return pages;
383d26
-    }
383d26
-
383d26
     /* When starting the process of a new block, the first page of
383d26
      * the block should be sent out before other pages in the same
383d26
      * block, and all the pages in last block should have been sent
383d26
@@ -1490,6 +1482,14 @@ err:
383d26
 static int ram_save_target_page(RAMState *rs, PageSearchStatus *pss,
383d26
                                 bool last_stage)
383d26
 {
383d26
+    RAMBlock *block = pss->block;
383d26
+    ram_addr_t offset = pss->page << TARGET_PAGE_BITS;
383d26
+    int res;
383d26
+
383d26
+    if (control_save_page(rs, block, offset, &res)) {
383d26
+        return res;
383d26
+    }
383d26
+
383d26
     /*
383d26
      * If xbzrle is on, stop using the data compression after first
383d26
      * round of migration even if compression is enabled. In theory,
383d26
-- 
383d26
1.8.3.1
383d26