Merge pull request #1834 from dalto8/btrfs-swap

[fstab] Use different options for the btrfs swap subvolume
This commit is contained in:
Adriaan de Groot 2021-11-29 15:16:17 +01:00 committed by GitHub
commit cdc3a9aad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -15,9 +15,13 @@
# With kernels 5.15 and newer be cautious of adding the option space_cache
# to the btrfs mount options. The default in 5.15 changed to space_cache=v2.
# If space_cache or space_cache=v1 are specified, it may fail to remount.
#
# btrfs_swap options are used when a swapfile is chosen with a btrfs root
# the options are applied to the subvolume which holds the swap partition
mountOptions:
default: defaults,noatime
btrfs: defaults,noatime,autodefrag,compress=zstd
btrfs_swap: defaults,noatime
# Mount options to use for the EFI System Partition. If not defined, the
# *mountOptions* for *vfat* are used, or if that is not set either,

View File

@ -22,6 +22,7 @@ properties:
xfs: { type: string }
swap: { type: string }
btrfs: { type: string }
btrfs_swap: { type: string }
efiMountOptions: { type: string }
crypttabOptions: { type: string }
required: [ mountOptions ]

View File

@ -236,6 +236,10 @@ class FstabGenerator(object):
libcalamares.utils.debug("Ignoring foreign swap {!s} {!s}".format(disk_name, partition.get("uuid", None)))
return None
# If this is btrfs subvol a dedicated to a swapfile, use different options than a normal btrfs subvol
if filesystem == "btrfs" and partition["subvol"] == "/@swap":
options = self.get_mount_options("btrfs_swap", mount_point)
else:
options = self.get_mount_options(filesystem, mount_point)
if is_ssd: