Skip to contentSkip to conversation

f2fs: compress: Allow modular (de)compression algorithms

PATCH In review Geert Uytterhoeven 3 participants 3 messages Feb 26, 2021 – Feb 27, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 f2fs: compress: Allow modular (de)compression algorithms

If F2FS_FS is modular, enabling the compressions options F2FS_FS_{LZ4,LZ4HZ,LZO,LZORLE,ZSTD} will make the (de)compression algorithms {LZ4,LZ4HC,LZO,ZSTD}_{,DE}COMPRESS builtin instead of modular, as the former depend on an intermediate boolean F2FS_FS_COMPRESSION, which in-turn depends on tristate F2FS_FS.

Indeed, if a boolean symbol A depends directly on a tristate symbol B and selects another tristate symbol C:

tristate B

tristate C

bool A
depends on B
select C

and B is modular, then C will also be modular.

However, if there is an intermediate boolean D in the dependency chain between A and B:

tristate B

tristate C

bool D
depends on B

bool A
depends on D
select C

then the modular state won't propagate from B to C, and C will be builtin instead of modular.

As modular dependency propagation through intermediate symbols is obscure, fix this in a robust way by moving the selection of tristate (de)compression algorithms from the boolean compression options to the tristate main F2FS_FS option.

---
v3:
- Drop redundant selects (F2FS_FS_LZORLE depends on F2FS_FS_LZO),

v2:
- Move the selects to F2FS_FS instead of adding direct dependencies

    on F2FS_FS.
---
 fs/f2fs/Kconfig | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
fs/f2fs/Kconfig +7 -9
index 62e638a49bbf089a..7669de7b49cea189 100644
@@ -7,6 +7,13 @@ config F2FS_FS
 	select CRYPTO_CRC32
 	select F2FS_FS_XATTR if FS_ENCRYPTION
 	select FS_ENCRYPTION_ALGS if FS_ENCRYPTION
+	select LZ4_COMPRESS if F2FS_FS_LZ4
+	select LZ4_DECOMPRESS if F2FS_FS_LZ4
+	select LZ4HC_COMPRESS if F2FS_FS_LZ4HC
+	select LZO_COMPRESS if F2FS_FS_LZO
+	select LZO_DECOMPRESS if F2FS_FS_LZO
+	select ZSTD_COMPRESS if F2FS_FS_ZSTD
+	select ZSTD_DECOMPRESS if F2FS_FS_ZSTD
 	help
 	  F2FS is based on Log-structured File System (LFS), which supports
 	  versatile "flash-friendly" features. The design has been focused on
@@ -94,8 +101,6 @@ config F2FS_FS_COMPRESSION
 config F2FS_FS_LZO
 	bool "LZO compression support"
 	depends on F2FS_FS_COMPRESSION
-	select LZO_COMPRESS
-	select LZO_DECOMPRESS
 	default y
 	help
 	  Support LZO compress algorithm, if unsure, say Y.
@@ -103,8 +108,6 @@ config F2FS_FS_LZO
 config F2FS_FS_LZ4
 	bool "LZ4 compression support"
 	depends on F2FS_FS_COMPRESSION
-	select LZ4_COMPRESS
-	select LZ4_DECOMPRESS
 	default y
 	help
 	  Support LZ4 compress algorithm, if unsure, say Y.
@@ -113,7 +116,6 @@ config F2FS_FS_LZ4HC
 	bool "LZ4HC compression support"
 	depends on F2FS_FS_COMPRESSION
 	depends on F2FS_FS_LZ4
-	select LZ4HC_COMPRESS
 	default y
 	help
 	  Support LZ4HC compress algorithm, LZ4HC has compatible on-disk
@@ -122,8 +124,6 @@ config F2FS_FS_LZ4HC
 config F2FS_FS_ZSTD
 	bool "ZSTD compression support"
 	depends on F2FS_FS_COMPRESSION
-	select ZSTD_COMPRESS
-	select ZSTD_DECOMPRESS
 	default y
 	help
 	  Support ZSTD compress algorithm, if unsure, say Y.
@@ -132,8 +132,6 @@ config F2FS_FS_LZORLE
 	bool "LZO-RLE compression support"
 	depends on F2FS_FS_COMPRESSION
 	depends on F2FS_FS_LZO
-	select LZO_COMPRESS
-	select LZO_DECOMPRESS
 	default y
 	help
 	  Support LZO-RLE compress algorithm, if unsure, say Y.
Signature · 8 lines
2.25.1



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Reviewed-by on v3 1/1
#1 lore raw
Quoted 37 lines · Geert Uytterhoeven

If F2FS_FS is modular, enabling the compressions options F2FS_FS_{LZ4,LZ4HZ,LZO,LZORLE,ZSTD} will make the (de)compression algorithms {LZ4,LZ4HC,LZO,ZSTD}_{,DE}COMPRESS builtin instead of modular, as the former depend on an intermediate boolean F2FS_FS_COMPRESSION, which in-turn depends on tristate F2FS_FS.

Indeed, if a boolean symbol A depends directly on a tristate symbol B and selects another tristate symbol C:

tristate B

tristate C

bool A
depends on B
select C

and B is modular, then C will also be modular.

However, if there is an intermediate boolean D in the dependency chain between A and B:

tristate B

tristate C

bool D
depends on B

bool A
depends on D
select C

then the modular state won't propagate from B to C, and C will be builtin instead of modular.

Quoted 6 lines

As modular dependency propagation through intermediate symbols is obscure, fix this in a robust way by moving the selection of tristate (de)compression algorithms from the boolean compression options to the tristate main F2FS_FS option.

Quoted 76 lines

---
v3:
- Drop redundant selects (F2FS_FS_LZORLE depends on F2FS_FS_LZO),

v2:
- Move the selects to F2FS_FS instead of adding direct dependencies

    on F2FS_FS.
---
 fs/f2fs/Kconfig | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
fs/f2fs/Kconfig +7 -10
index 62e638a49bbf089a..7669de7b49cea189 100644
@@ -7,6 +7,13 @@ config F2FS_FS
        select CRYPTO_CRC32
        select F2FS_FS_XATTR if FS_ENCRYPTION
        select FS_ENCRYPTION_ALGS if FS_ENCRYPTION
+       select LZ4_COMPRESS if F2FS_FS_LZ4
+       select LZ4_DECOMPRESS if F2FS_FS_LZ4
+       select LZ4HC_COMPRESS if F2FS_FS_LZ4HC
+       select LZO_COMPRESS if F2FS_FS_LZO
+       select LZO_DECOMPRESS if F2FS_FS_LZO
+       select ZSTD_COMPRESS if F2FS_FS_ZSTD
+       select ZSTD_DECOMPRESS if F2FS_FS_ZSTD
        help
          F2FS is based on Log-structured File System (LFS), which supports
          versatile "flash-friendly" features. The design has been focused on
@@ -94,8 +101,6 @@ config F2FS_FS_COMPRESSION
 config F2FS_FS_LZO
        bool "LZO compression support"
        depends on F2FS_FS_COMPRESSION
-       select LZO_COMPRESS
-       select LZO_DECOMPRESS
        default y
        help
          Support LZO compress algorithm, if unsure, say Y.
@@ -103,8 +108,6 @@ config F2FS_FS_LZO
 config F2FS_FS_LZ4
        bool "LZ4 compression support"
        depends on F2FS_FS_COMPRESSION
-       select LZ4_COMPRESS
-       select LZ4_DECOMPRESS
        default y
        help
          Support LZ4 compress algorithm, if unsure, say Y.
@@ -113,7 +116,6 @@ config F2FS_FS_LZ4HC
        bool "LZ4HC compression support"
        depends on F2FS_FS_COMPRESSION
        depends on F2FS_FS_LZ4
-       select LZ4HC_COMPRESS
        default y
        help
          Support LZ4HC compress algorithm, LZ4HC has compatible on-disk
@@ -122,8 +124,6 @@ config F2FS_FS_LZ4HC
 config F2FS_FS_ZSTD
        bool "ZSTD compression support"
        depends on F2FS_FS_COMPRESSION
-       select ZSTD_COMPRESS
-       select ZSTD_DECOMPRESS
        default y
        help
          Support ZSTD compress algorithm, if unsure, say Y.
@@ -132,8 +132,6 @@ config F2FS_FS_LZORLE
        bool "LZO-RLE compression support"
        depends on F2FS_FS_COMPRESSION
        depends on F2FS_FS_LZO
-       select LZO_COMPRESS
-       select LZO_DECOMPRESS
        default y
        help
          Support LZO-RLE compress algorithm, if unsure, say Y.
--

2.25.1

Signature · 8 lines
Best Regards
Masahiro Yamada


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Reviewed-by on v3 1/1
#2 lore raw
In reply to Geert Uytterhoeven
Quoted 36 lines · Geert Uytterhoeven

If F2FS_FS is modular, enabling the compressions options F2FS_FS_{LZ4,LZ4HZ,LZO,LZORLE,ZSTD} will make the (de)compression algorithms {LZ4,LZ4HC,LZO,ZSTD}_{,DE}COMPRESS builtin instead of modular, as the former depend on an intermediate boolean F2FS_FS_COMPRESSION, which in-turn depends on tristate F2FS_FS.

Indeed, if a boolean symbol A depends directly on a tristate symbol B and selects another tristate symbol C:

tristate B

tristate C

bool A
depends on B
select C

and B is modular, then C will also be modular.

However, if there is an intermediate boolean D in the dependency chain between A and B:

tristate B

tristate C

bool D
depends on B

bool A
depends on D
select C

then the modular state won't propagate from B to C, and C will be builtin instead of modular.

Quoted 6 lines

As modular dependency propagation through intermediate symbols is obscure, fix this in a robust way by moving the selection of tristate (de)compression algorithms from the boolean compression options to the tristate main F2FS_FS option.

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel