[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 06/10] migration: move some code ram_save_host_pa
From: |
guangrong . xiao |
Subject: |
[Qemu-devel] [PATCH v2 06/10] migration: move some code ram_save_host_page |
Date: |
Tue, 27 Mar 2018 17:10:39 +0800 |
From: Xiao Guangrong <address@hidden>
Move some code from ram_save_target_page() to ram_save_host_page()
to make it be more readable for latter patches that dramatically
clean ram_save_target_page() up
Signed-off-by: Xiao Guangrong <address@hidden>
---
migration/ram.c | 43 +++++++++++++++++++------------------------
1 file changed, 19 insertions(+), 24 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index fc1fde7bb7..104d3d3e9f 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1485,38 +1485,23 @@ err:
* Returns the number of pages written
*
* @rs: current RAM state
- * @ms: current migration state
* @pss: data about the page we want to send
* @last_stage: if we are at the completion stage
*/
static int ram_save_target_page(RAMState *rs, PageSearchStatus *pss,
bool last_stage)
{
- int res = 0;
-
- /* Check the pages is dirty and if it is send it */
- if (migration_bitmap_clear_dirty(rs, pss->block, pss->page)) {
- /*
- * If xbzrle is on, stop using the data compression after first
- * round of migration even if compression is enabled. In theory,
- * xbzrle can do better than compression.
- */
- if (migrate_use_compression() &&
- (rs->ram_bulk_stage || !migrate_use_xbzrle())) {
- res = ram_save_compressed_page(rs, pss, last_stage);
- } else {
- res = ram_save_page(rs, pss, last_stage);
- }
-
- if (res < 0) {
- return res;
- }
- if (pss->block->unsentmap) {
- clear_bit(pss->page, pss->block->unsentmap);
- }
+ /*
+ * If xbzrle is on, stop using the data compression after first
+ * round of migration even if compression is enabled. In theory,
+ * xbzrle can do better than compression.
+ */
+ if (migrate_use_compression() &&
+ (rs->ram_bulk_stage || !migrate_use_xbzrle())) {
+ return ram_save_compressed_page(rs, pss, last_stage);
}
- return res;
+ return ram_save_page(rs, pss, last_stage);
}
/**
@@ -1545,12 +1530,22 @@ static int ram_save_host_page(RAMState *rs,
PageSearchStatus *pss,
qemu_ram_pagesize(pss->block) >> TARGET_PAGE_BITS;
do {
+ /* Check the pages is dirty and if it is send it */
+ if (!migration_bitmap_clear_dirty(rs, pss->block, pss->page)) {
+ pss->page++;
+ continue;
+ }
+
tmppages = ram_save_target_page(rs, pss, last_stage);
if (tmppages < 0) {
return tmppages;
}
pages += tmppages;
+ if (pss->block->unsentmap) {
+ clear_bit(pss->page, pss->block->unsentmap);
+ }
+
pss->page++;
} while ((pss->page & (pagesize_bits - 1)) &&
offset_in_ramblock(pss->block, pss->page << TARGET_PAGE_BITS));
--
2.14.3
- [Qemu-devel] [PATCH v2 00/10] migration: improve and cleanup compression, guangrong . xiao, 2018/03/28
- [Qemu-devel] [PATCH v2 01/10] migration: stop compressing page in migration thread, guangrong . xiao, 2018/03/28
- [Qemu-devel] [PATCH v2 03/10] migration: stop decompression to allocate and free memory frequently, guangrong . xiao, 2018/03/28
- [Qemu-devel] [PATCH v2 04/10] migration: detect compression and decompression errors, guangrong . xiao, 2018/03/28
- [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 <=
- [Qemu-devel] [PATCH v2 07/10] migration: move calling control_save_page to the common place, guangrong . xiao, 2018/03/28
- [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