3 E2FSCK=../e2fsck/e2fsck
11 DIRENT_PER_LEAF=$(((BLOCKSZ - CSUM_TAIL_SZ) / (NAMELEN + DIRENT_SZ)))
14 INDEX_L1=$(((BLOCKSZ - HEADER - CSUM_SZ) / INDEX_SZ))
15 INDEX_L2=$(((BLOCKSZ - DIRENT_SZ - CSUM_SZ) / INDEX_SZ))
16 DIRBLK=$((3 + INDEX_L1 * INDEX_L2))
17 ENTRIES=$((DIRBLK * DIRENT_PER_LEAF))
18 # directory leaf blocks - get twice as much because the leaves won't be full
19 # and there are also other filesystem blocks.
22 $MKE2FS -b 1024 -O extents,64bit,large_dir,uninit_bg,metadata_csum -N 50 \
23 -I $INODESZ -F $TMPFILE $FSIZE > $OUT.new 2>&1
25 if [ $RC -eq 0 ]; then
27 # First some initial fs setup to create indexed dir
31 echo "write $TMPFILE.tmp foofile"
33 while test $i -lt $DIRENT_PER_LEAF ; do
34 printf "ln foofile f%0254u\n" $i
38 printf "ln foofile f%0254u\n" $i
39 } | $DEBUGFS -w $TMPFILE > /dev/null 2>> $OUT.new
41 # e2fsck should optimize the dir to become indexed
42 $E2FSCK -yfD $TMPFILE >> $OUT.new 2>&1
44 echo Exit status is $status >> $OUT.new
47 if [ $RC -eq 0 ]; then
50 i=$(($DIRENT_PER_LEAF+1))
53 while test $i -lt $ENTRIES ; do
54 ELAPSED=$((SECONDS - START))
55 if test $((i % 5000)) -eq 0 -a $ELAPSED -gt 10; then
56 RATE=$(((i - last) / ELAPSED))
57 echo "$test_name: $i/$ENTRIES links, ${ELAPSED}s @ $RATE/s" >&2
61 printf "ln foofile f%0254u\n" $i
64 } | $DEBUGFS -w $TMPFILE > /dev/null 2>> $OUT.new
68 if [ $RC -eq 0 ]; then
69 $E2FSCK -yfD $TMPFILE >> $OUT.new 2>&1
71 echo Exit status is $status >> $OUT.new
72 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT
78 if [ $RC -eq 0 ]; then
79 echo "$test_name: $test_description: ok"
82 echo "$test_name: $test_description: failed"
83 diff -u $EXP $OUT > $test_name.failed