[PATCH] makdumpfile: clean up the in-accurate message printing about mmap

Baoquan He bhe at redhat.com
Wed Mar 16 00:12:59 PDT 2016


mmap() is not used either caused by failure of mmap() in initialize_mmap(),
or because user explictly specify '--non-mmap'. So the message need be changed
according these different cases.

Signed-off-by: Baoquan He <bhe at redhat.com>
---
 makedumpfile.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index fa0b779..5703369 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -3949,14 +3949,17 @@ out:
 	if (info->dump_level & DL_EXCLUDE_FREE)
 		setup_page_is_buddy();
 
-	if (info->flag_usemmap == MMAP_TRY && initialize_mmap()) {
-		DEBUG_MSG("mmap() is available on the kernel.\n");
-		info->flag_usemmap = MMAP_ENABLE;
-	} else {
-		DEBUG_MSG("The kernel doesn't support mmap(),");
-		DEBUG_MSG("read() will be used instead.\n");
-		info->flag_usemmap = MMAP_DISABLE;
-        }
+	if (info->flag_usemmap == MMAP_TRY ) {
+		if (initialize_mmap()) {
+			DEBUG_MSG("mmap() is available on the kernel.\n");
+			info->flag_usemmap = MMAP_ENABLE;
+		} else {
+			DEBUG_MSG("The kernel doesn't support mmap(),");
+			DEBUG_MSG("read() will be used instead.\n");
+			info->flag_usemmap = MMAP_DISABLE;
+		}
+        } else if (info->flag_usemmap == MMAP_DISABLE)
+		DEBUG_MSG("mmap() is disabled by specified option '--non-mmap'.\n");
 
 	return TRUE;
 }
-- 
2.5.0




More information about the kexec mailing list