diff mbox series

[3/5] zram: support deflate compressor

Message ID 20240223035548.2591882-4-wangkefeng.wang@huawei.com (mailing list archive)
State New
Headers show
Series mm: unify default compressor algorithm for zram/zswap | expand

Commit Message

Kefeng Wang Feb. 23, 2024, 3:55 a.m. UTC
Add deflate compressor support, also it is prepare for unifying the
default compressor compressor for zram and zswap.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/block/zram/Kconfig | 7 ++++++-
 drivers/block/zram/zcomp.c | 3 +++
 2 files changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig
index 0cee425da0f5..b007dda16430 100644
--- a/drivers/block/zram/Kconfig
+++ b/drivers/block/zram/Kconfig
@@ -2,7 +2,7 @@ 
 config ZRAM
 	tristate "Compressed RAM block device support"
 	depends on SWAP && SYSFS
-	depends on CRYPTO_LZO || CRYPTO_ZSTD || CRYPTO_LZ4 || CRYPTO_LZ4HC || CRYPTO_842
+	depends on CRYPTO_LZO || CRYPTO_ZSTD || CRYPTO_LZ4 || CRYPTO_LZ4HC || CRYPTO_842 || CRYPTO_DEFLATE
 	select ZSMALLOC
 	help
 	  Creates virtual block devices called /dev/zramX (X = 0, 1, ...).
@@ -20,6 +20,10 @@  choice
 	default ZRAM_DEF_COMP_LZORLE
 	depends on ZRAM
 
+config ZRAM_DEF_COMP_DEFLATE
+	bool "Deflate"
+	depends on CRYPTO_DEFLATE
+
 config ZRAM_DEF_COMP_LZORLE
 	bool "lzo-rle"
 	depends on CRYPTO_LZO
@@ -48,6 +52,7 @@  endchoice
 
 config ZRAM_DEF_COMP
 	string
+	default "deflate" if ZRAM_DEF_COMP_DEFLATE
 	default "lzo-rle" if ZRAM_DEF_COMP_LZORLE
 	default "zstd" if ZRAM_DEF_COMP_ZSTD
 	default "lz4" if ZRAM_DEF_COMP_LZ4
diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
index 8237b08c49d8..1f9a431f771e 100644
--- a/drivers/block/zram/zcomp.c
+++ b/drivers/block/zram/zcomp.c
@@ -16,6 +16,9 @@ 
 #include "zcomp.h"
 
 static const char * const backends[] = {
+#if IS_ENABLED(CONFIG_CRYPTO_DEFLATE)
+	"deflate",
+#endif
 #if IS_ENABLED(CONFIG_CRYPTO_LZO)
 	"lzo",
 	"lzo-rle",