From 1021bcf44d0e876b10f8739594ad7e6e9c746026 Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Wed, 1 Aug 2018 19:23:37 +0800 Subject: pstore: add zstd compression support This patch added the 6th compression algorithm support for pstore: zstd. Signed-off-by: Geliang Tang Signed-off-by: Kees Cook --- fs/pstore/platform.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'fs/pstore/platform.c') 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 @@ #if IS_ENABLED(CONFIG_PSTORE_LZ4_COMPRESS) || IS_ENABLED(CONFIG_PSTORE_LZ4HC_COMPRESS) #include #endif +#if IS_ENABLED(CONFIG_PSTORE_ZSTD_COMPRESS) +#include +#endif #include #include #include @@ -192,6 +195,13 @@ static int zbufsize_842(size_t size) } #endif +#if IS_ENABLED(CONFIG_PSTORE_ZSTD_COMPRESS) +static int zbufsize_zstd(size_t size) +{ + return ZSTD_compressBound(size); +} +#endif + static const struct pstore_zbackend *zbackend __ro_after_init; static const struct pstore_zbackend zbackends[] = { @@ -224,6 +234,12 @@ static const struct pstore_zbackend zbackends[] = { .zbufsize = zbufsize_842, .name = "842", }, +#endif +#if IS_ENABLED(CONFIG_PSTORE_ZSTD_COMPRESS) + { + .zbufsize = zbufsize_zstd, + .name = "zstd", + }, #endif { } }; -- cgit v1.2.3