[RFC PATCH v2 4/10] Add function to update target region.

Atsushi Kumagai kumagai-atsushi at mxc.nes.nec.co.jp
Thu Jun 28 22:18:52 EDT 2012


update_cyclic_region() updates target region with recalculating partial bitmap
when traverse target region.
This function helps cyclic processing 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 e7c9f5e..67b3499 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -3878,6 +3878,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



More information about the kexec mailing list