From c964e085dac5d2e47974f1275a0557ec841aeaba Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Nigel Croxon Date: Thu, 14 Nov 2013 22:53:15 +0100 Subject: [PATCH 39/46] arch_init: make is_zero_page accept size RH-Author: Nigel Croxon Message-id: <1384469598-13137-40-git-send-email-ncroxon@redhat.com> Patchwork-id: 55717 O-Subject: [RHEL7.0 PATCH 39/42] arch_init: make is_zero_page accept size Bugzilla: 1011720 RH-Acked-by: Orit Wasserman RH-Acked-by: Amit Shah RH-Acked-by: Paolo Bonzini Bugzilla: 1011720 https://bugzilla.redhat.com/show_bug.cgi?id=1011720 >From commit ID: commit dc3c26a479e5bd19c1b3c04f696b8f70ad57f0b7 Author: Isaku Yamahata Date: Sat Sep 21 01:23:36 2013 +0900 arch_init: make is_zero_page accept size 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 Signed-off-by: Juan Quintela --- arch_init.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) Signed-off-by: Michal Novotny --- arch_init.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch_init.c b/arch_init.c index 26d0374..5ce9c61 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.7.11.7