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-rsalvate...@gmail.com/

Signed-off-by: Rui Salvaterra <rsalvate...@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


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to