Currently, zram code is included only when LZO is enabled. However,
more natural implementation is that if users encounter pages swapped
into zram that are compressed with unsupported compression algorithm,
crash notifies that. To do so, let's include zram code by default.
Signed-off-by: HATAYAMA Daisuke <d.hatayama(a)fujitsu.com>
---
defs.h | 2 --
diskdump.c | 11 ++++-------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/defs.h b/defs.h
index e468b1d..e1c837a 100644
--- a/defs.h
+++ b/defs.h
@@ -6538,7 +6538,6 @@ void diskdump_device_dump_info(FILE *);
void diskdump_device_dump_extract(int, char *, FILE *);
/*support for zram*/
ulong try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
vaddr);
-#ifdef LZO
#define OBJ_TAG_BITS 1
#ifndef MAX_POSSIBLE_PHYSMEM_BITS
#define MAX_POSSIBLE_PHYSMEM_BITS (MAX_PHYSMEM_BITS())
@@ -6564,7 +6563,6 @@ struct zspage {
unsigned int inuse;
unsigned int freeobj;
};
-#endif
/*
* makedumpfile.c
diff --git a/diskdump.c b/diskdump.c
index 143ac3c..8603d04 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -2591,7 +2591,6 @@ diskdump_device_dump_info(FILE *ofp)
}
}
-#ifdef LZO
static void
zram_init(void)
{
@@ -2775,6 +2774,7 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong
len, ulonglong
readmem(zram + OFFSET(zram_compressor), KVADDR, name,
sizeof(name), "zram compressor", FAULT_ON_ERROR);
if (STREQ(name, "lzo")) {
+#ifdef LZO
if (!(dd->flags & LZO_SUPPORTED)) {
if (lzo_init() == LZO_E_OK)
dd->flags |= LZO_SUPPORTED;
@@ -2782,6 +2782,9 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong
len, ulonglong
return 0;
}
decompressor = (void *)lzo1x_decompress_safe;
+#else
+ return 0;
+#endif
} else {//todo,support more compressor
error(WARNING, "only the lzo compressor is supported\n");
return 0;
@@ -2849,9 +2852,3 @@ out:
FREEBUF(zram_buf);
return len;
}
-#else
-ulong try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
vaddr)
-{
- return 0;
-}
-#endif
--
1.8.3.1