[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 8/9] arch_init: make is_zero_page accept size
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 8/9] arch_init: make is_zero_page accept size |
Date: |
Tue, 24 Sep 2013 14:03:22 +0200 |
From: Isaku Yamahata <address@hidden>
Later is_zero_page will be used for non TARGET_PAGE_SIZE
range.
And rename it to is_zero_range as it isn't page size any more.
Signed-off-by: Isaku Yamahata <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
---
arch_init.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 18cd9a1..c72790f 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -150,10 +150,9 @@ int qemu_read_default_config_files(bool userconfig)
return 0;
}
-static inline bool is_zero_page(uint8_t *p)
+static inline bool is_zero_range(uint8_t *p, uint64_t size)
{
- return buffer_find_nonzero_offset(p, TARGET_PAGE_SIZE) ==
- TARGET_PAGE_SIZE;
+ return buffer_find_nonzero_offset(p, size) == size;
}
/* struct contains XBZRLE cache and a static page
@@ -497,7 +496,7 @@ static int ram_save_block(QEMUFile *f, bool last_stage)
acct_info.dup_pages++;
}
}
- } else if (is_zero_page(p)) {
+ } else if (is_zero_range(p, TARGET_PAGE_SIZE)) {
acct_info.dup_pages++;
bytes_sent = save_block_hdr(f, block, offset, cont,
RAM_SAVE_FLAG_COMPRESS);
@@ -849,7 +848,7 @@ static inline void *host_from_stream_offset(QEMUFile *f,
*/
void ram_handle_compressed(void *host, uint8_t ch, uint64_t size)
{
- if (ch != 0 || !is_zero_page(host)) {
+ if (ch != 0 || !is_zero_range(host, TARGET_PAGE_SIZE)) {
memset(host, ch, size);
#ifndef _WIN32
if (ch == 0 &&
--
1.8.3.1
- [Qemu-devel] [PULL 0/9] migration queue, Juan Quintela, 2013/09/24
- [Qemu-devel] [PATCH 1/9] savevm: add comments for qemu_file_get_error(), Juan Quintela, 2013/09/24
- [Qemu-devel] [PATCH 2/9] savevm: fix wrong initialization by ram_control_load_hook, Juan Quintela, 2013/09/24
- [Qemu-devel] [PATCH 4/9] rdma: clean up of qemu_rdma_cleanup(), Juan Quintela, 2013/09/24
- [Qemu-devel] [PATCH 5/9] rdma: constify ram_chunk_{index, start, end}, Juan Quintela, 2013/09/24
- [Qemu-devel] [PATCH 6/9] migration: add version supporting macros for struct pointer, Juan Quintela, 2013/09/24
- [Qemu-devel] [PATCH 7/9] migration: Fix debug print type, Juan Quintela, 2013/09/24
- [Qemu-devel] [PATCH 9/9] migration: ram_handle_compressed, Juan Quintela, 2013/09/24
- [Qemu-devel] [PATCH 8/9] arch_init: make is_zero_page accept size,
Juan Quintela <=
- [Qemu-devel] [PATCH 3/9] arch_init: right return for ram_save_iterate, Juan Quintela, 2013/09/24