[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 07/10] migration: move calling control_save_page
From: |
guangrong . xiao |
Subject: |
[Qemu-devel] [PATCH v2 07/10] migration: move calling control_save_page to the common place |
Date: |
Tue, 27 Mar 2018 17:10:40 +0800 |
From: Xiao Guangrong <address@hidden>
The function is called by both ram_save_page and ram_save_target_page,
so move it to the common caller to cleanup the code
Reviewed-by: Peter Xu <address@hidden>
Signed-off-by: Xiao Guangrong <address@hidden>
---
migration/ram.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 104d3d3e9f..ce3ef4382d 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1039,10 +1039,6 @@ static int ram_save_page(RAMState *rs, PageSearchStatus
*pss, bool last_stage)
p = block->host + offset;
trace_ram_save_page(block->idstr, (uint64_t)offset, p);
- if (control_save_page(rs, block, offset, &pages)) {
- return pages;
- }
-
XBZRLE_cache_lock();
pages = save_zero_page(rs, block, offset);
if (pages > 0) {
@@ -1200,10 +1196,6 @@ static int ram_save_compressed_page(RAMState *rs,
PageSearchStatus *pss,
p = block->host + offset;
- if (control_save_page(rs, block, offset, &pages)) {
- return pages;
- }
-
/* When starting the process of a new block, the first page of
* the block should be sent out before other pages in the same
* block, and all the pages in last block should have been sent
@@ -1491,6 +1483,14 @@ err:
static int ram_save_target_page(RAMState *rs, PageSearchStatus *pss,
bool last_stage)
{
+ RAMBlock *block = pss->block;
+ ram_addr_t offset = pss->page << TARGET_PAGE_BITS;
+ int res;
+
+ if (control_save_page(rs, block, offset, &res)) {
+ return res;
+ }
+
/*
* If xbzrle is on, stop using the data compression after first
* round of migration even if compression is enabled. In theory,
--
2.14.3
- [Qemu-devel] [PATCH v2 04/10] migration: detect compression and decompression errors, (continued)
- [Qemu-devel] [PATCH v2 02/10] migration: stop compression to allocate and free memory frequently, guangrong . xiao, 2018/03/28
- [Qemu-devel] [PATCH v2 05/10] migration: introduce control_save_page(), guangrong . xiao, 2018/03/28
- [Qemu-devel] [PATCH v2 06/10] migration: move some code ram_save_host_page, guangrong . xiao, 2018/03/28
- [Qemu-devel] [PATCH v2 07/10] migration: move calling control_save_page to the common place,
guangrong . xiao <=
- [Qemu-devel] [PATCH v2 08/10] migration: move calling save_zero_page to the common place, guangrong . xiao, 2018/03/28
- [Qemu-devel] [PATCH v2 09/10] migration: introduce save_normal_page(), guangrong . xiao, 2018/03/28
- [Qemu-devel] [PATCH v2 10/10] migration: remove ram_save_compressed_page(), guangrong . xiao, 2018/03/28