1OUT=$test_name.log 2EXP=$test_dir/expect 3E2FSCK=../e2fsck/e2fsck 4 5NAMELEN=255 6DIRENT_SZ=8 7BLOCKSZ=1024 8INODESZ=128 9DIRENT_PER_LEAF=$((BLOCKSZ / (NAMELEN + DIRENT_SZ))) 10HEADER=32 11INDEX_SZ=8 12INDEX_L1=$(((BLOCKSZ - HEADER) / INDEX_SZ)) 13INDEX_L2=$(((BLOCKSZ - DIRENT_SZ) / INDEX_SZ)) 14DIRBLK=$((2 + INDEX_L1 * INDEX_L2)) 15ENTRIES=$((DIRBLK * DIRENT_PER_LEAF)) 16EXT4_LINK_MAX=65000 17if [ $ENTRIES -lt $((EXT4_LINK_MAX + 10)) ]; then 18 ENTRIES=$((EXT4_LINK_MAX + 10)) 19 DIRBLK=$((ENTRIES / DIRENT_PER_LEAF + 3)) 20fi 21# directory leaf blocks plus inode count and 25% for the rest of the fs 22FSIZE=$(((DIRBLK + EXT4_LINK_MAX * ((BLOCKSZ + INODESZ) / BLOCKSZ)) * 5 / 4)) 23 24$MKE2FS -b 1024 -O large_dir,uninit_bg -N $((ENTRIES + 50)) \ 25 -I $INODESZ -F $TMPFILE $FSIZE > $OUT.new 2>&1 26RC=$? 27if [ $RC -eq 0 ]; then 28{ 29 START=$SECONDS 30 echo "mkdir /foo" 31 echo "cd /foo" 32 touch $TMPFILE.tmp 33 echo "write $TMPFILE.tmp foofile" 34 i=0 35 last=0 36 while test $i -lt $ENTRIES ; do 37 if test $((i % DIRENT_PER_LEAF)) -eq 0; then 38 echo "expand ./" 39 fi 40 ELAPSED=$((SECONDS - START)) 41 if test $((i % 5000)) -eq 0 -a $ELAPSED -gt 10; then 42 RATE=$(((i - last) / ELAPSED)) 43 echo "$test_name: $i/$ENTRIES links, ${ELAPSED}s @ $RATE/s" >&2 44 START=$SECONDS 45 last=$i 46 fi 47 if test $i -lt $((EXT4_LINK_MAX + 10)); then 48 printf "mkdir d%0254u\n" $i 49 else 50 printf "ln foofile f%0254u\n" $i 51 fi 52 i=$((i + 1)) 53 done 54} | $DEBUGFS -w $TMPFILE > /dev/null 2>> $OUT.new 55 RC=$? 56fi 57if [ $RC -eq 0 ]; then 58 $E2FSCK -yfD $TMPFILE >> $OUT.new 2>&1 59 status=$? 60 echo Exit status is $status >> $OUT.new 61 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT 62 rm -f $OUT.new 63 64 cmp -s $OUT $EXP 65 RC=$? 66fi 67if [ $RC -eq 0 ]; then 68 echo "$test_name: $test_description: ok" 69 touch $test_name.ok 70else 71 echo "$test_name: $test_description: failed" 72 diff -u $EXP $OUT > $test_name.failed 73fi 74