File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,6 @@ config ZRAM
14
14
15
15
See Documentation/admin-guide/blockdev/zram.rst for more information.
16
16
17
- config ZRAM_BACKEND_LZO
18
- bool "lzo and lzo-rle compression support"
19
- depends on ZRAM
20
- select LZO_COMPRESS
21
- select LZO_DECOMPRESS
22
-
23
17
config ZRAM_BACKEND_LZ4
24
18
bool "lz4 compression support"
25
19
depends on ZRAM
@@ -50,6 +44,19 @@ config ZRAM_BACKEND_842
50
44
select 842_COMPRESS
51
45
select 842_DECOMPRESS
52
46
47
+ config ZRAM_BACKEND_FORCE_LZO
48
+ depends on ZRAM
49
+ def_bool !ZRAM_BACKEND_LZ4 && !ZRAM_BACKEND_LZ4HC && \
50
+ !ZRAM_BACKEND_ZSTD && !ZRAM_BACKEND_DEFLATE && \
51
+ !ZRAM_BACKEND_842
52
+
53
+ config ZRAM_BACKEND_LZO
54
+ bool "lzo and lzo-rle compression support" if !ZRAM_BACKEND_FORCE_LZO
55
+ depends on ZRAM
56
+ default ZRAM_BACKEND_FORCE_LZO
57
+ select LZO_COMPRESS
58
+ select LZO_DECOMPRESS
59
+
53
60
choice
54
61
prompt "Default zram compressor"
55
62
default ZRAM_DEF_COMP_LZORLE
Original file line number Diff line number Diff line change @@ -192,6 +192,14 @@ struct zcomp *zcomp_create(const char *alg)
192
192
struct zcomp * comp ;
193
193
int error ;
194
194
195
+ /*
196
+ * The backends array has a sentinel NULL value, so the minimum
197
+ * size is 1. In order to be valid the array, apart from the
198
+ * sentinel NULL element, should have at least one compression
199
+ * backend selected.
200
+ */
201
+ BUILD_BUG_ON (ARRAY_SIZE (backends ) <= 1 );
202
+
195
203
comp = kzalloc (sizeof (struct zcomp ), GFP_KERNEL );
196
204
if (!comp )
197
205
return ERR_PTR (- ENOMEM );
You can’t perform that action at this time.
0 commit comments