Skip to content

mkfs.btrfs: enabling only running kernel compatible features #598

@asj

Description

@asj

Binaries compiled from btrfs-progs source code have been compatible with older kernels if users use the -O option with mkfs.btrfs and specify the compatible features manually. Otherwise, a latest mkfs.btrfs may enable some features by default, even if the current kernel doesn't support them.

I propose a sub-option to enable only compatible features: mkfs.btrfs --features=by-sysfs <dev> by reading the sysfs.

List of on-disk format changes incompatible with previous kernel version unless feature was back-ported; attempting to mount on older kernel will fail.

RW incompatible:

mixed_backref   BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF
default_subvol  BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL
mixed_groups    BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS
compress_lzo    BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO
BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2
big_metadata    BTRFS_FEATURE_INCOMPAT_BIG_METADATA
extended_iref   BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF
raid56          BTRFS_FEATURE_INCOMPAT_RAID56
skinny_metadata BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA
no_holes        BTRFS_FEATURE_INCOMPAT_NO_HOLES
zstd compression
metadata-uuid   BTRFS_FEATURE_INCOMPAT_METADATA_UUID
raid1c34        BTRFS_FEATURE_INCOMPAT_RAID1C34
zone-device     BTRFS_FEATURE_INCOMPAT_ZONED
read support of blocksize<pagesize (subpage)
write support of blocksize<pagesize (subpage)
extent-tree-v2  BTRFS_FEATURE_INCOMPAT_EXTENT_TREE_V2

RO compatible only:

BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE
BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID
fsverity support BTRFS_FEATURE_COMPAT_RO_VERITY
block group tree BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE

RW incompatible checksumming algorithms:

blake2b  checksumming
sha256   checksumming
xxhash64 checksumming

Metadata

Metadata

Assignees

No one assigned

    Labels

    defaultsChanges in default settingsenhancementmkfsChanges in mkfs.btrfs

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions