[PATCH] [makedumpfile] Add `holes' in bitmap

Bernhard Walle bwalle at suse.de
Fri May 18 06:50:16 EDT 2007


On a big SGI machine with more than one node I experienced the problem that the
remaining buffer was larger than PFN_BUFBITMAP which resulted in an error.

I think the cause is that the holes must be filled in the bitmap. This patch
implements this.


Signed-off-by: Bernhard Walle <bwalle at suse.de>

---
 makedumpfile.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -3142,11 +3142,34 @@ create_dump_bitmap(struct DumpInfo *info
 	}
 
 	for (mm = 0; mm < info->num_mem_map; mm++) {
+		unsigned long long next_pfn_start;
+
 		mmd = &info->mem_map_data[mm];
 		pfn   = mmd->pfn_start;
 		paddr = pfn*info->page_size;
 		mem_map = mmd->mem_map;
 
+		/*
+		 * fill with zeros if start != 0
+		 */
+		if (mm == 0 && pfn != 0) {
+			int i;
+
+			for (;i < pfn; i++) {
+				set_bitmap(bm1.buf, i % BUFSIZE_BITMAP, 0);
+				set_bitmap(bm2.buf, i % BUFSIZE_BITMAP, 0);
+
+				if ((i % PFN_BUFBITMAP) == 0) {
+					bm1.buf_size = BUFSIZE_BITMAP;
+					bm2.buf_size = BUFSIZE_BITMAP;
+					if (!write_cache_bufsz(&bm1))
+						goto out;
+					if (!write_cache_bufsz(&bm2))
+						goto out;
+				}
+			}
+		}
+
 		if (mem_map == NOT_MEMMAP_ADDR)
 			not_found_mem_map = TRUE;
 		else
@@ -3291,6 +3314,34 @@ create_dump_bitmap(struct DumpInfo *info
 			 */
 			set_bitmap(bm2.buf, pfn%PFN_BUFBITMAP, val);
 		}
+
+		/*
+		 * fill the space between the memory maps with zeros
+		 */
+
+		if (mm != (info->num_mem_map - 1))
+			next_pfn_start = info->mem_map_data[mm+1].pfn_start;
+		else
+			next_pfn_start = info->max_mapnr;
+
+		for (; pfn < next_pfn_start; pfn++) {
+
+			/*
+			 * flush to disk
+			 */
+			if ((pfn % PFN_BUFBITMAP) == 0) {
+
+				bm1.buf_size = BUFSIZE_BITMAP;
+				bm2.buf_size = BUFSIZE_BITMAP;
+				if (!write_cache_bufsz(&bm1))
+					goto out;
+				if (!write_cache_bufsz(&bm2))
+					goto out;
+			}
+
+			set_bitmap(bm1.buf, pfn%PFN_BUFBITMAP, 0);
+			set_bitmap(bm2.buf, pfn%PFN_BUFBITMAP, 0);
+		}
 	}
 
 	/*



More information about the kexec mailing list