Skip to content

Commit 346a381

Browse files
committed
btrfs-progs: convert: add raid-stripe-tree to allowed features
The raid-stripe-tree can be enabled for convert, though it's still considered incomplete and slightly experimental. Due to that the tests need to be adjusted to check for support and skip mount eventually. Possible remaining options to add: quota, squota Issue: kdave#694 Signed-off-by: David Sterba <[email protected]>
1 parent 5b344c3 commit 346a381

File tree

8 files changed

+52
-15
lines changed

8 files changed

+52
-15
lines changed

common/fsfeatures.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ static const struct btrfs_mkfs_features btrfs_convert_allowed_features = {
6868
BTRFS_FEATURE_INCOMPAT_BIG_METADATA |
6969
BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF |
7070
BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA |
71-
BTRFS_FEATURE_INCOMPAT_NO_HOLES,
71+
BTRFS_FEATURE_INCOMPAT_NO_HOLES |
72+
BTRFS_FEATURE_INCOMPAT_RAID_STRIPE_TREE,
7273
.runtime_flags = BTRFS_FEATURE_RUNTIME_QUOTA,
7374
};
7475

tests/common.convert

+36-8
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,47 @@ convert_test_post_check_checksums() {
214214
grep -q 'FAILED' && _fail "file validation failed"
215215
}
216216

217+
# Check if convert can mount the image based on features
218+
# $1: name of the feature
219+
convert_can_mount() {
220+
local features="$1"
221+
222+
if [ "$features" = 'block-group-tree' ]; then
223+
if ! [ -f "/sys/fs/btrfs/features/block_group_tree" ]; then
224+
_log "Skip mount checks due to missing support of block-group-tree"
225+
return 1
226+
fi
227+
fi
228+
if [ "$features" = 'raid-stripe-tree' ]; then
229+
if ! [ -f "/sys/fs/btrfs/features/raid_stripe_tree" ]; then
230+
_log "Skip mount checks due to missing support of raid-stripe-tree"
231+
return 1
232+
fi
233+
fi
234+
235+
return 0
236+
}
237+
217238
# post conversion checks, all three in one call, on an unmounted image
218-
# $1: file with checksums
219-
# $2: file with permissions.
220-
# $3: file with acl entries.
239+
# $1: features for mount compatibility checks
240+
# $2: file with checksums
241+
# $3: file with permissions.
242+
# $4: file with acl entries.
221243
convert_test_post_checks_all() {
222-
_assert_path "$1"
244+
local features="$1"
245+
223246
_assert_path "$2"
224247
_assert_path "$3"
248+
_assert_path "$4"
249+
250+
if ! convert_can_mount "$features"; then
251+
return 0
252+
fi
225253

226254
run_check_mount_test_dev
227-
convert_test_post_check_checksums "$1"
228-
convert_test_post_check_permissions "$2"
229-
convert_test_post_check_acl "$3"
255+
convert_test_post_check_checksums "$2"
256+
convert_test_post_check_permissions "$3"
257+
convert_test_post_check_acl "$4"
230258

231259
# Create a large file to trigger data chunk allocation
232260
generate_dataset "large"
@@ -285,7 +313,7 @@ convert_test() {
285313
run_check_umount_test_dev
286314

287315
convert_test_do_convert "$features" "$nodesize" "$fstype"
288-
convert_test_post_checks_all "$CHECKSUMTMP" "$EXT_PERMTMP" "$EXT_ACLTMP"
316+
convert_test_post_checks_all "$features" "$CHECKSUMTMP" "$EXT_PERMTMP" "$EXT_ACLTMP"
289317
rm -- "$CHECKSUMTMP"
290318
rm -- "$EXT_PERMTMP"
291319
rm -- "$EXT_ACLTMP"

tests/convert-tests/001-ext2-basic/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ check_kernel_support_acl
1212

1313
# Iterate over defaults and options that are not tied to hardware capabilities
1414
# or number of devices
15-
for feature in '' 'block-group-tree' ; do
15+
for feature in '' 'block-group-tree' 'raid-stripe-tree'; do
1616
convert_test ext2 "$feature" "ext2 4k nodesize" 4096 mke2fs -b 4096
1717
convert_test ext2 "$feature" "ext2 16k nodesize" 16384 mke2fs -b 4096
1818
convert_test ext2 "$feature" "ext2 64k nodesize" 65536 mke2fs -b 4096

tests/convert-tests/003-ext4-basic/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ check_kernel_support_acl
1212

1313
# Iterate over defaults and options that are not tied to hardware capabilities
1414
# or number of devices
15-
for feature in '' 'block-group-tree' ; do
15+
for feature in '' 'block-group-tree' 'raid-stripe-tree' ; do
1616
convert_test ext4 "$feature" "ext4 4k nodesize" 4096 mke2fs -t ext4 -b 4096
1717
convert_test ext4 "$feature" "ext4 16k nodesize" 16384 mke2fs -t ext4 -b 4096
1818
convert_test ext4 "$feature" "ext4 64k nodesize" 65536 mke2fs -t ext4 -b 4096

tests/convert-tests/005-delete-all-rollback/test.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ do_test() {
3838

3939
convert_test_do_convert "$features" "$nodesize"
4040

41+
if ! convert_can_mount "$features"; then
42+
return 0
43+
fi
44+
4145
run_check_mount_test_dev
4246
convert_test_post_check_checksums "$CHECKSUMTMP"
4347

@@ -64,7 +68,7 @@ do_test() {
6468

6569
# Iterate over defaults and options that are not tied to hardware capabilities
6670
# or number of devices
67-
for feature in '' 'block-group-tree' ; do
71+
for feature in '' 'block-group-tree' 'raid-stripe-tree' ; do
6872
do_test "$feature" "ext4 4k nodesize" 4096 mke2fs -t ext4 -b 4096
6973
do_test "$feature" "ext4 16k nodesize" 16384 mke2fs -t ext4 -b 4096
7074
do_test "$feature" "ext4 64k nodesize" 65536 mke2fs -t ext4 -b 4096

tests/convert-tests/010-reiserfs-basic/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ prepare_test_dev
1515

1616
# Iterate over defaults and options that are not tied to hardware capabilities
1717
# or number of devices
18-
for feature in '' 'block-group-tree' ; do
18+
for feature in '' 'block-group-tree' 'raid-stripe-tree'; do
1919
convert_test reiserfs "$feature" "reiserfs 4k nodesize" 4096 mkreiserfs -b 4096
2020
convert_test reiserfs "$feature" "reiserfs 16k nodesize" 16384 mkreiserfs -b 4096
2121
convert_test reiserfs "$feature" "reiserfs 64k nodesize" 65536 mkreiserfs -b 4096

tests/convert-tests/011-reiserfs-delete-all-rollback/test.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ do_test() {
4040

4141
convert_test_do_convert "$features" "$nodesize"
4242

43+
if ! convert_can_mount "$features"; then
44+
return 0
45+
fi
46+
4347
run_check_mount_test_dev
4448
convert_test_post_check_checksums "$CHECKSUMTMP"
4549

@@ -66,7 +70,7 @@ do_test() {
6670

6771
# Iterate over defaults and options that are not tied to hardware capabilities
6872
# or number of devices
69-
for feature in '' 'block-group-tree' ; do
73+
for feature in '' 'block-group-tree' 'raid-stripe-tree'; do
7074
do_test "$feature" "reiserfs 4k nodesize" 4096 mkreiserfs -b 4096
7175
do_test "$feature" "reiserfs 16k nodesize" 16384 mkreiserfs -b 4096
7276
do_test "$feature" "reiserfs 64k nodesize" 65536 mkreiserfs -b 4096

tests/convert-tests/024-ntfs-basic/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ prepare_test_dev
1717

1818
# Iterate over defaults and options that are not tied to hardware capabilities
1919
# or number of devices. Test only 4K block size as minimum.
20-
for feature in '' 'block-group-tree' ; do
20+
for feature in '' 'block-group-tree' 'raid-stripe-tree'; do
2121
convert_test ntfs "$feature" "ntfs 4k nodesize" 4096 mkfs.ntfs -s 4096
2222
done

0 commit comments

Comments
 (0)