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)"
11 if grep -q 'release 6' /etc/redhat-release 2> /dev/null; then
12 echo "$test_name: $test_description: skipped (slow on EL6)"
20 DIRENT_PER_LEAF=$((BLOCKSZ / (NAMELEN + DIRENT_SZ)))
23 INDEX_L1=$(((BLOCKSZ - HEADER) / INDEX_SZ))
24 INDEX_L2=$(((BLOCKSZ - DIRENT_SZ) / INDEX_SZ))
25 DIRBLK=$((2 + INDEX_L1 * INDEX_L2))
26 ENTRIES=$((DIRBLK * DIRENT_PER_LEAF))
28 if [ $ENTRIES -lt $((EXT4_LINK_MAX + 10)) ]; then
29 ENTRIES=$((EXT4_LINK_MAX + 10))
30 DIRBLK=$((ENTRIES / DIRENT_PER_LEAF + 3))
32 # directory leaf blocks plus inode count and 25% for the rest of the fs
33 FSIZE=$(((DIRBLK + EXT4_LINK_MAX * ((BLOCKSZ + INODESZ) / BLOCKSZ)) * 5 / 4))
35 $MKE2FS -b 1024 -O large_dir,uninit_bg -N $((ENTRIES + 50)) \
36 -I $INODESZ -F $TMPFILE $FSIZE > $OUT.new 2>&1
38 if [ $RC -eq 0 ]; then
40 # First some initial fs setup to create indexed dir
44 echo "write $TMPFILE.tmp foofile"
46 while test $i -lt $DIRENT_PER_LEAF ; do
47 printf "mkdir d%0254u\n" $i
51 printf "mkdir d%0254u\n" $i
52 } | $DEBUGFS -w $TMPFILE > /dev/null 2>> $OUT.new
54 # e2fsck should optimize the dir to become indexed
55 $E2FSCK -yfD $TMPFILE >> $OUT.new 2>&1
57 echo Exit status is $status >> $OUT.new
60 if [ $RC -eq 0 ]; then
63 i=$(($DIRENT_PER_LEAF+1))
66 while test $i -lt $ENTRIES ; do
67 ELAPSED=$((SECONDS - START))
68 if test $((i % 5000)) -eq 0 -a $ELAPSED -gt 10; then
69 RATE=$(((i - last) / ELAPSED))
70 echo "$test_name: $i/$ENTRIES links, ${ELAPSED}s @ $RATE/s" >&2
74 if test $i -lt $((EXT4_LINK_MAX + 10)); then
75 printf "mkdir d%0254u\n" $i
77 printf "ln foofile f%0254u\n" $i
81 } | $DEBUGFS -w $TMPFILE > /dev/null 2>> $OUT.new
85 if [ $RC -eq 0 ]; then
86 $E2FSCK -yfD $TMPFILE >> $OUT.new 2>&1
88 echo Exit status is $status >> $OUT.new
89 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT
95 if [ $RC -eq 0 ]; then
96 echo "$test_name: $test_description: ok"
99 echo "$test_name: $test_description: failed"
100 diff -u $EXP $OUT > $test_name.failed