80 lines
2.3 KiB
Diff
80 lines
2.3 KiB
Diff
From 2254dc4e5710b594bbc47e8b28c88f96fc2b246e Mon Sep 17 00:00:00 2001
|
|
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
|
Date: Fri, 25 Dec 2020 15:48:48 +0900
|
|
Subject: [PATCH 07/11] zram: include zram code even without lzo library
|
|
|
|
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@fujitsu.com>
|
|
---
|
|
defs.h | 2 --
|
|
diskdump.c | 11 ++++-------
|
|
2 files changed, 4 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/defs.h b/defs.h
|
|
index 35b983abd403..ebd7bb615b61 100644
|
|
--- a/defs.h
|
|
+++ b/defs.h
|
|
@@ -6541,7 +6541,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())
|
|
@@ -6567,7 +6566,6 @@ struct zspage {
|
|
unsigned int inuse;
|
|
unsigned int freeobj;
|
|
};
|
|
-#endif
|
|
|
|
/*
|
|
* makedumpfile.c
|
|
diff --git a/diskdump.c b/diskdump.c
|
|
index 30cb73fe2e19..17094f126f25 100644
|
|
--- a/diskdump.c
|
|
+++ b/diskdump.c
|
|
@@ -2591,7 +2591,6 @@ diskdump_device_dump_info(FILE *ofp)
|
|
}
|
|
}
|
|
|
|
-#ifdef LZO
|
|
static void
|
|
zram_init(void)
|
|
{
|
|
@@ -2772,6 +2771,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;
|
|
@@ -2779,6 +2779,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;
|
|
@@ -2846,9 +2849,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
|
|
--
|
|
2.29.2
|
|
|