diff mbox series

fstools/overlay: allow forced zstd compression

Message ID 20210319142140.2397-1-rsalvaterra@gmail.com
State Under Review
Delegated to: Rui Salvaterra
Headers show
Series fstools/overlay: allow forced zstd compression | expand

Commit Message

Rui Salvaterra March 19, 2021, 2:21 p.m. UTC
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@gmail.com>
---
 CMakeLists.txt       | 2 ++
 libfstools/overlay.c | 2 ++
 2 files changed, 4 insertions(+)
diff mbox series

Patch

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