2 # Regression test for mkfs.btrfs --rootdir with inline file extents
3 # For any large inline file extent, btrfs check could already report it
5 source "$TEST_TOP/common"
7 check_global_prereq fallocate
8 check_prereq mkfs.btrfs
12 tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
14 pagesize=$(getconf PAGESIZE)
18 # Reuse size as filename
19 run_check fallocate -l $size "$tmp/$size"
25 run_check "$TOP/mkfs.btrfs" --nodesize $nodesize -f --rootdir "$tmp" \
27 run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
30 # Use power of 2 from 512 to 64K (maximum node size) as base file size
31 for i in 512 1024 2048 4096 8192 16384 32768; do
32 create_file $(($i - 102))
33 # 101 is the overhead size for max inline extent
34 create_file $(($i - 101))
35 create_file $(($i - 100))
37 create_file $(($i - 1))
39 create_file $(($i + 1))
42 for nodesize in 4096 8192 16384 32768 65536; do
43 if [ $nodesize -ge $pagesize ]; then
44 test_mkfs_rootdir $nodesize