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

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