From 902c4f7d71db0a0d2e4e24f77939926355c0e78b Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 20 Dec 2024 13:54:54 -0800 Subject: [PATCH] erofs: Add ability to set the cluster size `cluster-size` sets the maximum size of compress physical cluster size in bytes. --- stages/org.osbuild.erofs | 10 +++++++--- stages/org.osbuild.erofs.meta.json | 4 ++++ stages/test/test_erofs.py | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/stages/org.osbuild.erofs b/stages/org.osbuild.erofs index e52f2c6a..e15ec5c7 100755 --- a/stages/org.osbuild.erofs +++ b/stages/org.osbuild.erofs @@ -21,9 +21,13 @@ def main(inputs, output_dir, options): method += f",{compression['level']}" cmd += ["-z", method] - options = options.get("options") - if options: - cmd += ["-E", ",".join(options)] + erofs_options = options.get("options") + if erofs_options: + cmd += ["-E", ",".join(erofs_options)] + + cluster_size = options.get("cluster-size") + if cluster_size: + cmd += ["-C", f"{cluster_size}"] subprocess.run(cmd, check=True) diff --git a/stages/org.osbuild.erofs.meta.json b/stages/org.osbuild.erofs.meta.json index ccce36e3..0f675189 100644 --- a/stages/org.osbuild.erofs.meta.json +++ b/stages/org.osbuild.erofs.meta.json @@ -38,6 +38,10 @@ } } }, + "cluster-size": { + "description": "Maximum size of the compress physical cluster in bytes", + "type": "number" + }, "options": { "description": "Extended options for the filesystem, see mkfs.erofs(1)", "type": "array", diff --git a/stages/test/test_erofs.py b/stages/test/test_erofs.py index 3b41519f..d74bde2d 100644 --- a/stages/test/test_erofs.py +++ b/stages/test/test_erofs.py @@ -15,6 +15,7 @@ TEST_INPUT = [ ({"compression": {"method": "lz4hc", "level": 9}}, ["-z", "lz4hc,9"]), ({"options": ["dedupe"]}, ["-E", "dedupe"]), ({"options": ["all-fragments", "force-inode-compact"]}, ["-E", "all-fragments,force-inode-compact"]), + ({"cluster-size": 131072, "options": ["dedupe"]}, ["-E", "dedupe", "-C", "131072"]), ]