[RFC PATCH v2 5/10] Add function to get num_dumpable for cyclic processing.
Atsushi Kumagai
kumagai-atsushi at mxc.nes.nec.co.jp
Thu Jun 28 22:19:55 EDT 2012
get_num_dumpable_cyclic() gets the number of dumpable pages with cyclic processing.
This function is used to get info->num_dumpable and it is necessary to decide
the offset of kdump-compressed page data.
Signed-off-by: Atsushi Kumagai <kumagai-atsushi at mxc.nes.nec.co.jp>
---
makedumpfile.c | 17 +++++++++++++++++
makedumpfile.h | 6 ++++++
2 files changed, 23 insertions(+)
diff --git a/makedumpfile.c b/makedumpfile.c
index 67b3499..30857e3 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -4094,6 +4094,8 @@ create_dump_bitmap(void)
if (info->flag_cyclic) {
if (!prepare_bitmap_buffer_cyclic())
goto out;
+
+ info->num_dumpable = get_num_dumpable_cyclic();
} else {
if (!prepare_bitmap_buffer())
goto out;
@@ -4555,6 +4557,21 @@ get_num_dumpable(void)
return num_dumpable;
}
+unsigned long long
+get_num_dumpable_cyclic(void)
+{
+ unsigned long long pfn, num_dumpable=0;
+
+ for (pfn = 0; pfn < info->max_mapnr; pfn++) {
+ if (!update_cyclic_region(pfn))
+ return FALSE;
+
+ if (is_dumpable_cyclic(info->partial_bitmap2, pfn))
+ num_dumpable++;
+ }
+
+ return num_dumpable;
+}
int
write_elf_load_segment(struct cache_data *cd_page, unsigned long long paddr,
diff --git a/makedumpfile.h b/makedumpfile.h
index 1a49aa2..e336814 100644
--- a/makedumpfile.h
+++ b/makedumpfile.h
@@ -938,6 +938,7 @@ struct DumpInfo {
char *partial_bitmap2;
unsigned long long cyclic_start_pfn;
unsigned long long cyclic_end_pfn;
+ unsigned long long num_dumpable;
/*
* sadump info:
@@ -1511,4 +1512,9 @@ struct elf_prstatus {
#endif
+/*
+ * Function Prototype.
+ */
+unsigned long long get_num_dumpable_cyclic(void);
+
#endif /* MAKEDUMPFILE_H */
--
1.7.9.2
More information about the kexec
mailing list