From: Atsushi Kumagai <[email protected]>
Date: Thu, 23 Aug 2012 17:53:59 +0900
Subject: [PATCH 05/16] [PATCH v3 5/12] Add function to get num_dumpable for 
cyclic mode.

get_num_dumpable_cyclic() gets the number of dumpable pages with cyclic mode.
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 <[email protected]>
---
 makedumpfile.c |   17 +++++++++++++++++
 makedumpfile.h |    6 ++++++
 2 files changed, 23 insertions(+)

diff --git a/makedumpfile.c b/makedumpfile.c
index 64bc031..d007aea 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -4110,6 +4110,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;
@@ -4571,6 +4573,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

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to