[PATCH] fstools/overlay: allow forced zstd compression

Rui Salvaterra rsalvaterra at gmail.com
Fri Mar 19 14:21:40 GMT 2021


While forced zlib compression is already supported, zstd is much faster at the
same compression ratios. Prepare fstools to mount the overlay with forced zstd
compression, This is already supported in ubifs, while there's a pending patch
for jffs2 [1].

[1] https://lore.kernel.org/linux-mtd/20210316141916.447493-1-rsalvaterra@gmail.com/

Signed-off-by: Rui Salvaterra <rsalvaterra at gmail.com>
---
 CMakeLists.txt       | 2 ++
 libfstools/overlay.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 422f27d..3dbc1da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,6 +58,8 @@ INSTALL(FILES libubi/libubi-tiny.h libubi/libubi.h libubi/ubi-media.h
 
 IF(DEFINED CMAKE_OVL_MOUNT_COMPRESS_ZLIB)
 	ADD_DEFINITIONS(-DOVL_MOUNT_COMPRESS_ZLIB)
+ELSEIF(DEFINED CMAKE_OVL_MOUNT_COMPRESS_ZSTD)
+	ADD_DEFINITIONS(-DOVL_MOUNT_COMPRESS_ZSTD)
 ENDIF(DEFINED CMAKE_OVL_MOUNT_COMPRESS_ZLIB)
 
 IF(DEFINED CMAKE_OVL_MOUNT_FULL_ACCESS_TIME)
diff --git a/libfstools/overlay.c b/libfstools/overlay.c
index eadafcf..db083d4 100644
--- a/libfstools/overlay.c
+++ b/libfstools/overlay.c
@@ -355,6 +355,8 @@ static int overlay_mount_fs(struct volume *v)
 #endif
 #ifdef OVL_MOUNT_COMPRESS_ZLIB
 		"compr=zlib"
+#elif OVL_MOUNT_COMPRESS_ZSTD
+		"compr=zstd"
 #else
 		NULL
 #endif
-- 
2.31.0




More information about the openwrt-devel mailing list