[PATCH] erofs-utils: add missing help for multiple algorithms

Gao Xiang hsiangkao at linux.alibaba.com
Sat Mar 11 15:12:45 AEDT 2023


Users can try this with the detailed instructions.

Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 docs/compress-hints.example |  7 +++++++
 man/mkfs.erofs.1            | 13 ++++++++-----
 mkfs/main.c                 |  3 ++-
 3 files changed, 17 insertions(+), 6 deletions(-)
 create mode 100644 docs/compress-hints.example

diff --git a/docs/compress-hints.example b/docs/compress-hints.example
new file mode 100644
index 0000000..4f481ff
--- /dev/null
+++ b/docs/compress-hints.example
@@ -0,0 +1,7 @@
+# https://github.com/debuerreotype/docker-debian-artifacts/blob/dist-amd64/bullseye/rootfs.tar.xz?raw=true
+# -zlzma:lz4hc,12:lzma,109 -C131072 --compress-hints=compress-hints.example  image size: 66M
+# -zlz4hc,12                                                                 image size: 76M
+4096     1 .*\.so.*$
+4096     1 bin/
+4096     1 sbin/
+131072   2 etc/
diff --git a/man/mkfs.erofs.1 b/man/mkfs.erofs.1
index e237877..82ef138 100644
--- a/man/mkfs.erofs.1
+++ b/man/mkfs.erofs.1
@@ -20,10 +20,11 @@ mkfs.erofs is used to create such EROFS filesystem \fIDESTINATION\fR image file
 from \fISOURCE\fR directory.
 .SH OPTIONS
 .TP
-.BI "\-z " compression-algorithm " [" ",#" "]"
-Set an algorithm for file compression, which can be set with an optional
+.BI "\-z " compression-algorithm " [" ",#" "]" " [:" " ... " "]"
+Set a primary algorithm for data compression, which can be set with an optional
 compression level (1 to 12 for LZ4HC, 0 to 9 for LZMA and 100 to 109 for LZMA
-extreme compression) separated by a comma.
+extreme compression) separated by a comma.  Alternative algorithms could be
+specified and separated by colons.
 .TP
 .BI "\-C " max-pcluster-size
 Specify the maximum size of compress physical cluster in bytes. It may enable
@@ -112,9 +113,11 @@ If the optional
 argument is given,
 .B mkfs.erofs
 uses it to apply the per-file compression strategy. Each line is defined by
-tokens separated by spaces in the following form:
+tokens separated by spaces in the following form.  Optionally, instead of
+the given primary algorithm, alternative algorithms could be specified with
+\fIalgorithm-index\fR by hand:
 .RS 1.2i
-<pcluster-in-bytes> <match-pattern>
+<pcluster-in-bytes> [algorithm-index] <match-pattern>
 .RE
 .TP
 .BI "\-\-exclude-path=" path
diff --git a/mkfs/main.c b/mkfs/main.c
index a3b0c34..94f51df 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -84,7 +84,8 @@ static void usage(void)
 	      "Generate erofs image from DIRECTORY to FILE, and [options] are:\n"
 	      " -d#                   set output message level to # (maximum 9)\n"
 	      " -x#                   set xattr tolerance to # (< 0, disable xattrs; default 2)\n"
-	      " -zX[,Y]               X=compressor (Y=compression level, optional)\n"
+	      " -zX[,Y][:..]          X=compressor (Y=compression level, optional)\n"
+	      "                       alternative algorithms can be separated by colons(:)\n"
 	      " -C#                   specify the size of compress physical cluster in bytes\n"
 	      " -EX[,...]             X=extended options\n"
 	      " -L volume-label       set the volume label (maximum 16)\n"
-- 
2.36.1



More information about the Linux-erofs mailing list