3 E2FSCK=../e2fsck/e2fsck
5 # skip this test on aarch64 builders because it is extremely slow
6 if [ "`uname -m`" = "aarch64" ]; then
7 echo "$test_name: $test_description: skipped (slow on aarch64)"
15 DIRENT_PER_LEAF=$((BLOCKSZ / (NAMELEN + DIRENT_SZ)))
18 INDEX_L1=$(((BLOCKSZ - HEADER) / INDEX_SZ))
19 INDEX_L2=$(((BLOCKSZ - DIRENT_SZ) / INDEX_SZ))
20 DIRBLK=$((2 + INDEX_L1 * INDEX_L2))
21 ENTRIES=$((DIRBLK * DIRENT_PER_LEAF))
23 if [ $ENTRIES -lt $((EXT4_LINK_MAX + 10)) ]; then
24 ENTRIES=$((EXT4_LINK_MAX + 10))
25 DIRBLK=$((ENTRIES / DIRENT_PER_LEAF + 3))
27 # directory leaf blocks plus inode count and 25% for the rest of the fs
28 FSIZE=$(((DIRBLK + EXT4_LINK_MAX * ((BLOCKSZ + INODESZ) / BLOCKSZ)) * 5 / 4))
30 $MKE2FS -b 1024 -O large_dir,uninit_bg -N $((ENTRIES + 50)) \
31 -I $INODESZ -F $TMPFILE $FSIZE > $OUT.new 2>&1
33 if [ $RC -eq 0 ]; then
35 # First some initial fs setup to create indexed dir
39 echo "write $TMPFILE.tmp foofile"
41 while test $i -lt $DIRENT_PER_LEAF ; do
42 printf "mkdir d%0254u\n" $i
46 printf "mkdir d%0254u\n" $i
47 } | $DEBUGFS -w $TMPFILE > /dev/null 2>> $OUT.new
49 # e2fsck should optimize the dir to become indexed
50 $E2FSCK -yfD $TMPFILE >> $OUT.new 2>&1
52 echo Exit status is $status >> $OUT.new
55 if [ $RC -eq 0 ]; then
58 i=$(($DIRENT_PER_LEAF+1))
61 while test $i -lt $ENTRIES ; do
62 ELAPSED=$((SECONDS - START))
63 if test $((i % 5000)) -eq 0 -a $ELAPSED -gt 10; then
64 RATE=$(((i - last) / ELAPSED))
65 echo "$test_name: $i/$ENTRIES links, ${ELAPSED}s @ $RATE/s" >&2
69 if test $i -lt $((EXT4_LINK_MAX + 10)); then
70 printf "mkdir d%0254u\n" $i
72 printf "ln foofile f%0254u\n" $i
76 } | $DEBUGFS -w $TMPFILE > /dev/null 2>> $OUT.new
80 if [ $RC -eq 0 ]; then
81 $E2FSCK -yfD $TMPFILE >> $OUT.new 2>&1
83 echo Exit status is $status >> $OUT.new
84 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT
90 if [ $RC -eq 0 ]; then
91 echo "$test_name: $test_description: ok"
94 echo "$test_name: $test_description: failed"
95 diff -u $EXP $OUT > $test_name.failed