erofs: Add ability to set the cluster size

`cluster-size` sets the maximum size of compress physical cluster size
in bytes.
This commit is contained in:
Brian C. Lane 2024-12-20 13:54:54 -08:00 committed by Achilleas Koutsou
parent 1ab098fbf9
commit 902c4f7d71
3 changed files with 12 additions and 3 deletions

View file

@ -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)

View file

@ -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",

View file

@ -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"]),
]