2 # Confirm btrfs check can check file extents without causing false alert
4 source "$TEST_TOP/common"
7 check_prereq mkfs.btrfs
10 check_global_prereq fallocate
11 check_global_prereq truncate
16 # Do some write into a large prealloc range
17 # Lowmem mode can report missing csum due to wrong csum range
18 test_paritical_write_into_prealloc()
20 run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV"
21 run_check_mount_test_dev
23 run_check $SUDO_HELPER fallocate -l 128K "$TEST_MNT/file"
25 run_check $SUDO_HELPER dd conv=notrunc if=/dev/zero of="$TEST_MNT/file" bs=1K count=64
26 run_check_umount_test_dev
27 run_check "$TOP/btrfs" check "$TEST_DEV"
30 # Inline compressed file extent
31 # Lowmem mode can cause silent error without any error message
32 # due to too restrict check on inline extent size
33 test_compressed_inline_extent()
35 run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV"
36 run_check_mount_test_dev -o compress=lzo,max_inline=2048
38 run_check $SUDO_HELPER dd conv=notrunc if=/dev/null of="$TEST_MNT/file" bs=1K count=1
39 run_check_umount_test_dev
40 run_check "$TOP/btrfs" check "$TEST_DEV"
43 # File extent hole with NO_HOLES incompat feature set.
44 # Lowmem mode will cause a false alert as it doesn't allow any file hole
45 # extents, while we can set NO_HOLES at anytime we want, it's definitely a
47 test_hole_extent_with_no_holes_flag()
49 run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV"
50 run_check_mount_test_dev
52 run_check $SUDO_HELPER truncate -s 16K "$TEST_MNT/tmp"
53 run_check_umount_test_dev
54 run_check $SUDO_HELPER "$TOP/btrfstune" -n "$TEST_DEV"
55 run_check "$TOP/btrfs" check "$TEST_DEV"
58 test_paritical_write_into_prealloc
59 test_compressed_inline_extent
60 test_hole_extent_with_no_holes_flag