enable btrfs light zstd:1 compression by default at mount

this comes free and is handled gracefully by btrfs according to
pre-compression heuristics, making it an ideal filesystem choice for
tomb volumes that have compressable contents.

A `compress-force=zstd:1` custom option would deactivate the heuristic
test and compress everything.
This commit is contained in:
Jaromil 2024-09-01 07:57:08 +02:00
parent 4783456814
commit ff692999de

12
tomb
View File

@ -2384,10 +2384,18 @@ mount_tomb() {
_sudo mkdir -p "$tombmount"
# Default mount options are overridden with the -o switch
local oldmountopts
{ option_is_set -o } && {
local oldmountopts=$MOUNTOPTS
oldmountopts=$MOUNTOPTS
# TODO: safety check MOUNTOPTS coming from user
MOUNTOPTS="$(option_value -o)" }
# TODO: safety check MOUNTOPTS
# default btrfs compression zstd:1 (oportunistic according to pre-compression heuristics)
# see: https://btrfs.readthedocs.io/en/latest/Compression.html#pre-compression-heuristics
[[ "$filesystem" = "btrfs" ]] && {
MOUNTOPTS="$MOUNTOPTS,compress=zstd:1"
}
# safe_mount_options &&
_sudo mount -o $MOUNTOPTS /dev/mapper/${TOMBMAPPER} "${tombmount}"
# Clean up if the mount failed