aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-15 12:22:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-15 12:22:52 -0400
commit3529b9703c112279d3c302ba0a941ac3a33daa37 (patch)
treedbf6862be5067dc48e11ad60d298c8e12eeae822
parent8c479c2c0f9dc105c0afaa662a22f39383d4ce92 (diff)
parent1021bcf44d0e876b10f8739594ad7e6e9c746026 (diff)
Merge tag 'pstore-v4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull pstore update from Kees Cook: "This cycle has been very quiet for pstore: the only change is adding awareness of the zstd compression method" * tag 'pstore-v4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: pstore: add zstd compression support
-rw-r--r--fs/pstore/Kconfig17
-rw-r--r--fs/pstore/platform.c16
2 files changed, 30 insertions, 3 deletions
diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig
index 09c19ef91526..503086f7f7c1 100644
--- a/fs/pstore/Kconfig
+++ b/fs/pstore/Kconfig
@@ -50,12 +50,19 @@ config PSTORE_842_COMPRESS
50 help 50 help
51 This option enables 842 compression algorithm support. 51 This option enables 842 compression algorithm support.
52 52
53config PSTORE_ZSTD_COMPRESS
54 bool "zstd compression"
55 depends on PSTORE
56 select CRYPTO_ZSTD
57 help
58 This option enables zstd compression algorithm support.
59
53config PSTORE_COMPRESS 60config PSTORE_COMPRESS
54 def_bool y 61 def_bool y
55 depends on PSTORE 62 depends on PSTORE
56 depends on PSTORE_DEFLATE_COMPRESS || PSTORE_LZO_COMPRESS || \ 63 depends on PSTORE_DEFLATE_COMPRESS || PSTORE_LZO_COMPRESS || \
57 PSTORE_LZ4_COMPRESS || PSTORE_LZ4HC_COMPRESS || \ 64 PSTORE_LZ4_COMPRESS || PSTORE_LZ4HC_COMPRESS || \
58 PSTORE_842_COMPRESS 65 PSTORE_842_COMPRESS || PSTORE_ZSTD_COMPRESS
59 66
60choice 67choice
61 prompt "Default pstore compression algorithm" 68 prompt "Default pstore compression algorithm"
@@ -65,8 +72,8 @@ choice
65 This change be changed at boot with "pstore.compress=..." on 72 This change be changed at boot with "pstore.compress=..." on
66 the kernel command line. 73 the kernel command line.
67 74
68 Currently, pstore has support for 5 compression algorithms: 75 Currently, pstore has support for 6 compression algorithms:
69 deflate, lzo, lz4, lz4hc and 842. 76 deflate, lzo, lz4, lz4hc, 842 and zstd.
70 77
71 The default compression algorithm is deflate. 78 The default compression algorithm is deflate.
72 79
@@ -85,6 +92,9 @@ choice
85 config PSTORE_842_COMPRESS_DEFAULT 92 config PSTORE_842_COMPRESS_DEFAULT
86 bool "842" if PSTORE_842_COMPRESS 93 bool "842" if PSTORE_842_COMPRESS
87 94
95 config PSTORE_ZSTD_COMPRESS_DEFAULT
96 bool "zstd" if PSTORE_ZSTD_COMPRESS
97
88endchoice 98endchoice
89 99
90config PSTORE_COMPRESS_DEFAULT 100config PSTORE_COMPRESS_DEFAULT
@@ -95,6 +105,7 @@ config PSTORE_COMPRESS_DEFAULT
95 default "lz4" if PSTORE_LZ4_COMPRESS_DEFAULT 105 default "lz4" if PSTORE_LZ4_COMPRESS_DEFAULT
96 default "lz4hc" if PSTORE_LZ4HC_COMPRESS_DEFAULT 106 default "lz4hc" if PSTORE_LZ4HC_COMPRESS_DEFAULT
97 default "842" if PSTORE_842_COMPRESS_DEFAULT 107 default "842" if PSTORE_842_COMPRESS_DEFAULT
108 default "zstd" if PSTORE_ZSTD_COMPRESS_DEFAULT
98 109
99config PSTORE_CONSOLE 110config PSTORE_CONSOLE
100 bool "Log kernel console messages" 111 bool "Log kernel console messages"
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index c238ab8ba31d..15e99d5a681d 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -34,6 +34,9 @@
34#if IS_ENABLED(CONFIG_PSTORE_LZ4_COMPRESS) || IS_ENABLED(CONFIG_PSTORE_LZ4HC_COMPRESS) 34#if IS_ENABLED(CONFIG_PSTORE_LZ4_COMPRESS) || IS_ENABLED(CONFIG_PSTORE_LZ4HC_COMPRESS)
35#include <linux/lz4.h> 35#include <linux/lz4.h>
36#endif 36#endif
37#if IS_ENABLED(CONFIG_PSTORE_ZSTD_COMPRESS)
38#include <linux/zstd.h>
39#endif
37#include <linux/crypto.h> 40#include <linux/crypto.h>
38#include <linux/string.h> 41#include <linux/string.h>
39#include <linux/timer.h> 42#include <linux/timer.h>
@@ -192,6 +195,13 @@ static int zbufsize_842(size_t size)
192} 195}
193#endif 196#endif
194 197
198#if IS_ENABLED(CONFIG_PSTORE_ZSTD_COMPRESS)
199static int zbufsize_zstd(size_t size)
200{
201 return ZSTD_compressBound(size);
202}
203#endif
204
195static const struct pstore_zbackend *zbackend __ro_after_init; 205static const struct pstore_zbackend *zbackend __ro_after_init;
196 206
197static const struct pstore_zbackend zbackends[] = { 207static const struct pstore_zbackend zbackends[] = {
@@ -225,6 +235,12 @@ static const struct pstore_zbackend zbackends[] = {
225 .name = "842", 235 .name = "842",
226 }, 236 },
227#endif 237#endif
238#if IS_ENABLED(CONFIG_PSTORE_ZSTD_COMPRESS)
239 {
240 .zbufsize = zbufsize_zstd,
241 .name = "zstd",
242 },
243#endif
228 { } 244 { }
229}; 245};
230 246