mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pstore: add zstd compression support
@ 2018-08-01 11:23 Geliang Tang
  2018-08-01 22:38 ` Kees Cook
  2018-08-03  8:25 ` kbuild test robot
  0 siblings, 2 replies; 5+ messages in thread
From: Geliang Tang @ 2018-08-01 11:23 UTC (permalink / raw)
  To: Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck
  Cc: Geliang Tang, linux-kernel

This patch added the 6th compression algorithm support for pstore: zstd.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 fs/pstore/Kconfig    | 17 ++++++++++++++---
 fs/pstore/platform.c | 16 ++++++++++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig
index 09c19ef91526..63cf4813559a 100644
--- a/fs/pstore/Kconfig
+++ b/fs/pstore/Kconfig
@@ -50,12 +50,19 @@ config PSTORE_842_COMPRESS
 	help
 	  This option enables 842 compression algorithm support.
 
+config PSTORE_ZSTD_COMPRESS
+	tristate "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"
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 <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
 	{ }
 };
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pstore: add zstd compression support
  2018-08-01 11:23 [PATCH] pstore: add zstd compression support Geliang Tang
@ 2018-08-01 22:38 ` Kees Cook
  2018-08-03  8:25 ` kbuild test robot
  1 sibling, 0 replies; 5+ messages in thread
From: Kees Cook @ 2018-08-01 22:38 UTC (permalink / raw)
  To: Geliang Tang; +Cc: Anton Vorontsov, Colin Cross, Tony Luck, LKML

On Wed, Aug 1, 2018 at 4:23 AM, Geliang Tang <geliangtang@gmail.com> wrote:
> This patch added the 6th compression algorithm support for pstore: zstd.
>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>

Thanks! I've applied this to my tree and it should be visible in -next soon.

> +#if IS_ENABLED(CONFIG_PSTORE_ZSTD_COMPRESS)
> +static int zbufsize_zstd(size_t size)
> +{
> +       return ZSTD_compressBound(size);
> +}
> +#endif

One thing I've been pondering is if there might be a way to extend the
crypto compression API to provide the "buffer output size" interface
directly. If that happened, pstore wouldn't need per-compression-algo
entries like it still has.

-Kees

-- 
Kees Cook
Pixel Security

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pstore: add zstd compression support
  2018-08-01 11:23 [PATCH] pstore: add zstd compression support Geliang Tang
  2018-08-01 22:38 ` Kees Cook
@ 2018-08-03  8:25 ` kbuild test robot
  1 sibling, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2018-08-03  8:25 UTC (permalink / raw)
  To: linux-kernel-owner
  Cc: kbuild-all, Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck,
	Geliang Tang, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]

Hi linux-kernel-owner,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on kees/for-next/pstore]
[also build test ERROR on v4.18-rc7 next-20180802]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/linux-kernel-owner-vger-kernel-org/pstore-add-zstd-compression-support/20180802-195306
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/pstore
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   fs/pstore/platform.o: In function `zbufsize_zstd':
>> platform.c:(.text+0x172): undefined reference to `ZSTD_compressBound'

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 62833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pstore: add zstd compression support
  2018-03-21 12:29 Geliang Tang
@ 2018-04-23  8:03 ` Geliang Tang
  0 siblings, 0 replies; 5+ messages in thread
From: Geliang Tang @ 2018-04-23  8:03 UTC (permalink / raw)
  To: Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck, Nick Terrell
  Cc: linux-kernel

On Wed, Mar 21, 2018 at 08:29:31PM +0800, Geliang Tang wrote:
> This patch added the 6th compression algorithm support for pstore: zstd.
> 
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
> ---
> Depend on 'crypto: Add zstd support' by Nick Terrell <terrelln@fb.com>

Hi Kees,

The patch 'crypto: zstd - Add zstd support' has been applied to
linux-next tree, 20180423, already. So we can use zstd in pstore
compression now. Please reconsider if my patch can be applied.

Thanks.
-Geliang

> ---
>  fs/pstore/Kconfig    | 17 ++++++++++++++---
>  fs/pstore/platform.c | 16 ++++++++++++++++
>  2 files changed, 30 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig
> index 09c19ef91526..63cf4813559a 100644
> --- a/fs/pstore/Kconfig
> +++ b/fs/pstore/Kconfig
> @@ -50,12 +50,19 @@ config PSTORE_842_COMPRESS
>  	help
>  	  This option enables 842 compression algorithm support.
>  
> +config PSTORE_ZSTD_COMPRESS
> +	tristate "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"
> diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
> index 1143ef351c58..9df8cdc378f5 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 <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
>  	{ }
>  };
> -- 
> 2.14.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] pstore: add zstd compression support
@ 2018-03-21 12:29 Geliang Tang
  2018-04-23  8:03 ` Geliang Tang
  0 siblings, 1 reply; 5+ messages in thread
From: Geliang Tang @ 2018-03-21 12:29 UTC (permalink / raw)
  To: Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck
  Cc: Geliang Tang, linux-kernel

This patch added the 6th compression algorithm support for pstore: zstd.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
Depend on 'crypto: Add zstd support' by Nick Terrell <terrelln@fb.com>
---
 fs/pstore/Kconfig    | 17 ++++++++++++++---
 fs/pstore/platform.c | 16 ++++++++++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig
index 09c19ef91526..63cf4813559a 100644
--- a/fs/pstore/Kconfig
+++ b/fs/pstore/Kconfig
@@ -50,12 +50,19 @@ config PSTORE_842_COMPRESS
 	help
 	  This option enables 842 compression algorithm support.
 
+config PSTORE_ZSTD_COMPRESS
+	tristate "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"
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 1143ef351c58..9df8cdc378f5 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 <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
 	{ }
 };
-- 
2.14.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-03  8:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-01 11:23 [PATCH] pstore: add zstd compression support Geliang Tang
2018-08-01 22:38 ` Kees Cook
2018-08-03  8:25 ` kbuild test robot
  -- strict thread matches above, loose matches on Subject: below --
2018-03-21 12:29 Geliang Tang
2018-04-23  8:03 ` Geliang Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®