mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-18 20:35:24 +00:00
bed70b939f
[BUG] Commit "btrfs-progs: prepare merging compat feature lists" tries to merged "-O" and "-R" options, as they don't correctly represents btrfs features. But that commit caused the following bug during mkfs for experimental build: $ mkfs.btrfs -f -O block-group-tree /dev/nvme0n1 btrfs-progs v5.19.1 See http://btrfs.wiki.kernel.org for more information. ERROR: superblock magic doesn't match ERROR: illegal nodesize 16384 (not equal to 4096 for mixed block group) [CAUSE] Currently btrfs_parse_fs_features() will return a u64, and reuse the same u64 for both incompat and compat RO flags for experimental branch. This can easily leads to conflicts, as BTRFS_FEATURE_INCOMPAT_MIXED_BLOCK_GROUP and BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE both share the same bit (1 << 2). Thus for above case, mkfs.btrfs believe it has set MIXED_BLOCK_GROUP feature, but what we really want is BLOCK_GROUP_TREE. [FIX] Instead of incorrectly re-using the same bits in btrfs_feature, split the old flags into 3 flags: - incompat_flag - compat_ro_flag - runtime_flag The first two flags are easy to understand, the corresponding flag of each feature. The last runtime_flag is to compensate features which doesn't have any on-disk flag set, like QUOTA and LIST_ALL. And since we're no longer using a single u64 as features, we have to introduce a new structure, btrfs_mkfs_features, to contain above 3 flags. This also mean, things like default mkfs features must be converted to use the new structure, thus those old macros are all converted to const static structures: - BTRFS_MKFS_DEFAULT_FEATURES + BTRFS_MKFS_DEFAULT_RUNTIME_FEATURES -> btrfs_mkfs_default_features - BTRFS_CONVERT_ALLOWED_FEATURES -> btrfs_convert_allowed_features And since we're using a structure, it's not longer as easy to implement a disallowed mask. Thus functions with @mask_disallowed are all changed to using an @allowed structure pointer (which can be NULL). Finally if we have experimental features enabled, all features can be specified by -O options, and we can output a unified feature list, instead of the old split ones. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> |
||
---|---|---|
.. | ||
common.c | ||
common.h | ||
main.c | ||
Makefile | ||
source-ext2.c | ||
source-ext2.h | ||
source-fs.c | ||
source-fs.h | ||
source-reiserfs.c | ||
source-reiserfs.h |