2 # create a base image, convert to btrfs, remove all files, rollback the ext4 image
5 source "$TOP/tests/common"
6 source "$TOP/tests/common.convert"
10 check_prereq btrfs-convert
12 # simple wrapper for a convert test
13 # $1: btrfs features, argument to -O
16 # $4 + rest: command to create the ext2 image
28 convert_test_preamble "$features" "$msg" "$nodesize" "$@"
29 convert_test_prep_fs "$@"
31 CHECKSUMTMP=$(mktemp --tmpdir btrfs-progs-convert.XXXXXXXXXX)
32 convert_test_gen_checksums "$CHECKSUMTMP"
34 run_check_umount_test_dev
36 convert_test_do_convert "$features" "$nodesize"
38 run_check_mount_test_dev
39 convert_test_post_check_checksums "$CHECKSUMTMP"
42 cd "$TEST_MNT" || _fail "cannot cd to TEST_MNT"
43 # ext2_saved/image must not be deleted
44 run_mayfail $SUDO_HELPER find "$TEST_MNT"/ -mindepth 1 -path '*ext2_saved' -prune -o -exec rm -vrf "{}" \;
46 run_check "$TOP/btrfs" filesystem sync "$TEST_MNT"
47 run_check_umount_test_dev
48 convert_test_post_rollback
50 run_check_mount_test_dev
51 convert_test_post_check_checksums "$CHECKSUMTMP"
52 run_check_umount_test_dev
54 # mount again and verify checksums
55 run_check_mount_test_dev
56 convert_test_post_check_checksums "$CHECKSUMTMP"
57 run_check_umount_test_dev
62 for feature in '' 'extref' 'skinny-metadata' 'no-holes'; do
63 do_test "$feature" "ext4 4k nodesize" 4096 mke2fs -t ext4 -b 4096
64 do_test "$feature" "ext4 8k nodesize" 8192 mke2fs -t ext4 -b 4096
65 do_test "$feature" "ext4 16k nodesize" 16384 mke2fs -t ext4 -b 4096
66 do_test "$feature" "ext4 32k nodesize" 32768 mke2fs -t ext4 -b 4096
67 do_test "$feature" "ext4 64k nodesize" 65536 mke2fs -t ext4 -b 4096