From: Atsushi Kumagai <kumagai-atsushi@xxxxxxxxxxxxxxxxx> Date: Thu, 23 Aug 2012 17:53:55 +0900 Subject: [PATCH 04/16] [PATCH v3 4/12] Add function to update target region. update_cyclic_region() updates target region with recalculating partial bitmap when traverse target region. This function helps cyclic mode to update partial bitmap for target region. Signed-off-by: Atsushi Kumagai <kumagai-atsushi at mxc.nes.nec.co.jp> --- makedumpfile.c | 21 +++++++++++++++++++++ makedumpfile.h | 9 +++++++++ 2 files changed, 30 insertions(+) diff --git a/makedumpfile.c b/makedumpfile.c index f706e29..64bc031 100644 --- a/makedumpfile.c +++ b/makedumpfile.c @@ -3894,6 +3894,27 @@ exclude_unnecessary_pages_cyclic(void) } int +update_cyclic_region(unsigned long long pfn) +{ + if (is_cyclic_region(pfn)) + return TRUE; + + info->cyclic_start_pfn = round(pfn, PFN_CYCLIC); + info->cyclic_end_pfn = info->cyclic_start_pfn + PFN_CYCLIC; + + if (info->cyclic_end_pfn > info->max_mapnr) + info->cyclic_end_pfn = info->max_mapnr; + + if (!create_1st_bitmap_cyclic()) + return FALSE; + + if (!exclude_unnecessary_pages_cyclic()) + return FALSE; + + return TRUE; +} + +int copy_bitmap(void) { off_t offset; diff --git a/makedumpfile.h b/makedumpfile.h index bf5dd43..1a49aa2 100644 --- a/makedumpfile.h +++ b/makedumpfile.h @@ -1418,6 +1418,15 @@ is_dumpable_cyclic(char *bitmap, unsigned long long pfn) } static inline int +is_cyclic_region(unsigned long long pfn) +{ + if (pfn < info->cyclic_start_pfn || info->cyclic_end_pfn <= pfn) + return FALSE; + else + return TRUE; +} + +static inline int is_zero_page(unsigned char *buf, long page_size) { size_t i; -- 1.7.9.2