Mixed block groups can be requested either with the -M/--mixed flag or
with the -O mixed-bg filesystem feature.
However using "mkfs.btrfs -O mixed-bg" results non-mixed block groups:
Label: (null)
UUID:
8b6b2eaf-d399-4190-8b64-
fcbed24f20fe
Node size: 4096
Sector size: 4096 (CPU page size: 4096)
Filesystem size: 2.00GiB
Block group profiles:
Data: single 8.00MiB <<<
Metadata: DUP 102.38MiB <<<
Data+Metadata: single 8.00MiB
System: DUP 8.00MiB
As "-O mixed-bg" option didn't properly set @mixed variable, thus
regular non-mixed block groups are still created.
Fix it by setting @mixed if BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS feature
is also set.
Signed-off-by: Andrus Suvalau <andrus.suvalau@n-able.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
[ Update the commit message to show the problem more clearly ]
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Andrus Suvalau <andrus.suvalau@n-able.com>
features.incompat_flags |= BTRFS_FEATURE_INCOMPAT_ZONED;
}
+ if (features.incompat_flags & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS)
+ mixed = true;
+
/*
* Set default profiles according to number of added devices.
* For mixed groups defaults are single/single.
--- /dev/null
+#!/bin/bash
+# Test that both -M and the FS feature mixed-bg create a FS with the same
+# data and metadata profiles.
+
+source "$TEST_TOP/common" || exit
+
+check_prereq mkfs.btrfs
+
+setup_root_helper
+prepare_test_dev
+
+check_mixed() {
+ local output
+ output=$(run_check_stdout "$TOP/mkfs.btrfs" "$@" -f "$TEST_DEV" | grep -E 'Data|Metadata')
+
+ if echo "$output" | grep -q -v 'Data+Metadata:'; then
+ _fail "created a mixed-bg filesystem with differing profiles using '$*' options"
+ fi
+}
+
+check_mixed -M
+check_mixed -O mixed-bg