# prepare TEST_DEV before conversion, create filesystem and mount it, image
# size is 512MB
-# $@: free form, command to create the filesystem, with appended -F
+# $1: type of the filesystem
+# $2+: free form, command to create the filesystem, with appended -F
convert_test_prep_fs() {
+ local fstype
+
+ fstype="$1"
+ shift
# TEST_DEV not removed as the file might have special permissions, eg.
# when test image is on NFS and would not be writable for root
run_check truncate -s 0 "$TEST_DEV"
}
# simple wrapper for a convert test
-# $1: btrfs features, argument to -O
-# $2: description of the test "ext2 8k nodesize"
-# $3: nodesize value
-# $4 + rest: command to create the ext2 image
+# $1: type of the converted filesystem
+# $2: btrfs features, argument to -O
+# $3: description of the test "ext2 8k nodesize"
+# $4: nodesize value
+# $5 + rest: command to create the ext2 image
convert_test() {
+ local fstype
local features
local nodesize
local msg
local EXT_PERMTMP
local EXT_ACLTMP
- features="$1"
- msg="$2"
- nodesize="$3"
- shift 3
+ fstype="$1"
+ features="$2"
+ msg="$3"
+ nodesize="$4"
+ shift 4
convert_test_preamble "$features" "$msg" "$nodesize" "$@"
- convert_test_prep_fs "$@"
+ convert_test_prep_fs "$fstype" "$@"
populate_fs
CHECKSUMTMP=$(mktemp --tmpdir btrfs-progs-convert.XXXXXXXXXX)
EXT_PERMTMP=$(mktemp --tmpdir btrfs-progs-convert.permXXXXXX)
check_prereq btrfs-convert
for feature in '' 'extref' 'skinny-metadata' 'no-holes'; do
- convert_test "$feature" "ext2 4k nodesize" 4096 mke2fs -b 4096
- convert_test "$feature" "ext2 8k nodesize" 8192 mke2fs -b 4096
- convert_test "$feature" "ext2 16k nodesize" 16384 mke2fs -b 4096
- convert_test "$feature" "ext2 32k nodesize" 32768 mke2fs -b 4096
- convert_test "$feature" "ext2 64k nodesize" 65536 mke2fs -b 4096
+ convert_test ext2 "$feature" "ext2 4k nodesize" 4096 mke2fs -b 4096
+ convert_test ext2 "$feature" "ext2 8k nodesize" 8192 mke2fs -b 4096
+ convert_test ext2 "$feature" "ext2 16k nodesize" 16384 mke2fs -b 4096
+ convert_test ext2 "$feature" "ext2 32k nodesize" 32768 mke2fs -b 4096
+ convert_test ext2 "$feature" "ext2 64k nodesize" 65536 mke2fs -b 4096
done
check_prereq btrfs-convert
for feature in '' 'extref' 'skinny-metadata' 'no-holes'; do
- convert_test "$feature" "ext3 4k nodesize" 4096 mke2fs -j -b 4096
- convert_test "$feature" "ext3 8k nodesize" 8192 mke2fs -j -b 4096
- convert_test "$feature" "ext3 16k nodesize" 16384 mke2fs -j -b 4096
- convert_test "$feature" "ext3 32k nodesize" 32768 mke2fs -j -b 4096
- convert_test "$feature" "ext3 64k nodesize" 65536 mke2fs -j -b 4096
+ convert_test ext3 "$feature" "ext3 4k nodesize" 4096 mke2fs -j -b 4096
+ convert_test ext3 "$feature" "ext3 8k nodesize" 8192 mke2fs -j -b 4096
+ convert_test ext3 "$feature" "ext3 16k nodesize" 16384 mke2fs -j -b 4096
+ convert_test ext3 "$feature" "ext3 32k nodesize" 32768 mke2fs -j -b 4096
+ convert_test ext3 "$feature" "ext3 64k nodesize" 65536 mke2fs -j -b 4096
done
check_prereq btrfs-convert
for feature in '' 'extref' 'skinny-metadata' 'no-holes'; do
- convert_test "$feature" "ext4 4k nodesize" 4096 mke2fs -t ext4 -b 4096
- convert_test "$feature" "ext4 8k nodesize" 8192 mke2fs -t ext4 -b 4096
- convert_test "$feature" "ext4 16k nodesize" 16384 mke2fs -t ext4 -b 4096
- convert_test "$feature" "ext4 32k nodesize" 32768 mke2fs -t ext4 -b 4096
- convert_test "$feature" "ext4 64k nodesize" 65536 mke2fs -t ext4 -b 4096
+ convert_test ext4 "$feature" "ext4 4k nodesize" 4096 mke2fs -t ext4 -b 4096
+ convert_test ext4 "$feature" "ext4 8k nodesize" 8192 mke2fs -t ext4 -b 4096
+ convert_test ext4 "$feature" "ext4 16k nodesize" 16384 mke2fs -t ext4 -b 4096
+ convert_test ext4 "$feature" "ext4 32k nodesize" 32768 mke2fs -t ext4 -b 4096
+ convert_test ext4 "$feature" "ext4 64k nodesize" 65536 mke2fs -t ext4 -b 4096
done
nodesize="$3"
shift 3
convert_test_preamble "$features" "$msg" "$nodesize" "$@"
- convert_test_prep_fs "$@"
+ convert_test_prep_fs ext4 "$@"
populate_fs
CHECKSUMTMP=$(mktemp --tmpdir btrfs-progs-convert.XXXXXXXXXX)
convert_test_gen_checksums "$CHECKSUMTMP"
default_mke2fs="mke2fs -t ext4 -b 4096"
convert_test_preamble '' 'large hole extent test' 16k "$default_mke2fs"
-convert_test_prep_fs $default_mke2fs
+convert_test_prep_fs ext4 $default_mke2fs
run_check $SUDO_HELPER dd if=/dev/zero of="$TEST_MNT/file" bs=1M \
count=1 seek=1024 > /dev/null 2>&1
for bs in 1024 2048; do
default_mke2fs="mke2fs -t ext4 -b $bs"
convert_test_preamble '' "unsupported block size $bs" 16k "$default_mke2fs"
- convert_test_prep_fs $default_mke2fs
+ convert_test_prep_fs ext4 $default_mke2fs
run_check $SUDO_HELPER dd if=/dev/zero of="$TEST_MNT/file" bs=1M \
count=1 seek=1024 > /dev/null 2>&1
default_mke2fs="mke2fs -t ext4 -b 4096"
convert_test_preamble '' 'readonly image test' 16k "$default_mke2fs"
-convert_test_prep_fs $default_mke2fs
+convert_test_prep_fs ext4 $default_mke2fs
run_check_umount_test_dev
convert_test_do_convert
run_check_mount_test_dev
fail=0
default_mke2fs="mke2fs -t ext4 -b 4096"
convert_test_preamble '' 'common inode flags test' 16k "$default_mke2fs"
-convert_test_prep_fs $default_mke2fs
+convert_test_prep_fs ext4 $default_mke2fs
# create file with specific flags
run_check $SUDO_HELPER touch "$TEST_MNT/flag_test"