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>
This commit is contained in:
HATAYAMA Daisuke 2020-12-25 15:48:48 +09:00 committed by Kazuhito Hagio
parent 8a877e9146
commit 2254dc4e57
2 changed files with 4 additions and 9 deletions

2
defs.h
View File

@ -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

View File

@ -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