- Add awareness of zstd compression (Geliang Tang)

-----BEGIN PGP SIGNATURE-----
 Comment: Kees Cook <kees@outflux.net>
 
 iQJKBAABCgA0FiEEpcP2jyKd1g9yPm4TiXL039xtwCYFAltx60wWHGtlZXNjb29r
 QGNocm9taXVtLm9yZwAKCRCJcvTf3G3AJqmtD/43lXkoLGl31JsCVkVASg2K34B3
 DI6uc4vwqJmGCNo9JrGGFNOqnV9n/rBg77Ymi6qDVRImbDm6t3FofaPLTVU1G9oK
 3KYlv7x99j6DoFmP+U6sEvnRb5znqrmFR/t6Nx4yn7p68XY6hd7IFx8wZ6ZNt26i
 eNUN67Hzg+eEuuDSf1XbVLIbeY9qqIyJvjqf6WUWXD2iAxcVPBUyxpNcsEGtmqti
 9e76t/iaPq+T4V8AODthl/lfyD/xauD6g48CpIRTeDvEbkC/cBZgYS3y5frVv4+d
 xve5j8aM2YYIaWzJGeE+3j+PXY6pdq/50iSPalo0SQg8ypaDpB7IRYmnBoR08dlX
 GNQxNLkfqXGniJf5Khaxzta9l25yjr8nRC3mLkI42dM/FIhHWi3/wF6nJSMaKZXJ
 FAZPC06VZR4Amb2pseNtRd09nYRDtqydmjsq53Y/1X0aaqgDiX1vEtothroLS4J1
 Lg3VWNzKjowTA40xc0z/5H+8jxw2gUfjtJKIQvYvaNXmEEfC+BvHk9OC5ZHSizu5
 PvBHNTGD2inyOpjWZishr6bgpeS4K/i/IDJy6UkFF1Q+z3udRbQTqWEUwwVjRnO0
 IlluTw7PcEy5ctbcLT+ABjdyjtWGzp0lATx+s3YvvZ53MvM20rV6nj9CPwfk+PE1
 MyqBBtSvtGvOsl9p9g==
 =3N3c
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2018-08-15 09:22:52 -07:00
commit 3529b9703c
2 changed files with 30 additions and 3 deletions

View File

@ -50,12 +50,19 @@ config PSTORE_842_COMPRESS
help
This option enables 842 compression algorithm support.
config PSTORE_ZSTD_COMPRESS
bool "zstd compression"
depends on PSTORE
select CRYPTO_ZSTD
help
This option enables zstd compression algorithm support.
config PSTORE_COMPRESS
def_bool y
depends on PSTORE
depends on PSTORE_DEFLATE_COMPRESS || PSTORE_LZO_COMPRESS || \
PSTORE_LZ4_COMPRESS || PSTORE_LZ4HC_COMPRESS || \
PSTORE_842_COMPRESS
PSTORE_842_COMPRESS || PSTORE_ZSTD_COMPRESS
choice
prompt "Default pstore compression algorithm"
@ -65,8 +72,8 @@ choice
This change be changed at boot with "pstore.compress=..." on
the kernel command line.
Currently, pstore has support for 5 compression algorithms:
deflate, lzo, lz4, lz4hc and 842.
Currently, pstore has support for 6 compression algorithms:
deflate, lzo, lz4, lz4hc, 842 and zstd.
The default compression algorithm is deflate.
@ -85,6 +92,9 @@ choice
config PSTORE_842_COMPRESS_DEFAULT
bool "842" if PSTORE_842_COMPRESS
config PSTORE_ZSTD_COMPRESS_DEFAULT
bool "zstd" if PSTORE_ZSTD_COMPRESS
endchoice
config PSTORE_COMPRESS_DEFAULT
@ -95,6 +105,7 @@ config PSTORE_COMPRESS_DEFAULT
default "lz4" if PSTORE_LZ4_COMPRESS_DEFAULT
default "lz4hc" if PSTORE_LZ4HC_COMPRESS_DEFAULT
default "842" if PSTORE_842_COMPRESS_DEFAULT
default "zstd" if PSTORE_ZSTD_COMPRESS_DEFAULT
config PSTORE_CONSOLE
bool "Log kernel console messages"

View File

@ -34,6 +34,9 @@
#if IS_ENABLED(CONFIG_PSTORE_LZ4_COMPRESS) || IS_ENABLED(CONFIG_PSTORE_LZ4HC_COMPRESS)
#include <linux/lz4.h>
#endif
#if IS_ENABLED(CONFIG_PSTORE_ZSTD_COMPRESS)
#include <linux/zstd.h>
#endif
#include <linux/crypto.h>
#include <linux/string.h>
#include <linux/timer.h>
@ -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
{ }
};