4 # Exercise xfs_prepair - ensure repeated use doesn't corrupt
5 # This is a clone of test 031 using xfs_prepair instead of xfs_repair
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
9 #-----------------------------------------------------------------------
15 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
23 # get standard environment, filters and checks
28 [ -z $XFS_PARALLEL_REPAIR_PROG ] && _notrun "parallel repair binary xfs_prepair is not installed"
30 # force use of parallel repair
31 export XFS_REPAIR_PROG=$XFS_PARALLEL_REPAIR_PROG
35 echo "Repairing, round 0" >> $seq.full
36 _scratch_xfs_repair 2>&1 | _filter_repair | tee -a $seq.full >$tmp.0
39 echo "Repairing, iteration $i" | tee -a $seq.full
40 _scratch_xfs_repair 2>&1 | _filter_repair >$tmp.$i
41 diff $tmp.0 $tmp.$i >> $seq.full
43 echo "ERROR: repair round $i differs to round 0 (see $seq.full)" | tee -a $seq.full
46 # echo all interesting stuff...
48 s/(rebuilding directory inode) (\d+)/\1 INO/g;
49 s/internal log/<TYPEOF> log/g;
50 s/external log on \S+/<TYPEOF> log/g;
57 # prototype file to create various directory forms
63 # take inode size into account for non-shortform directories...
64 [ $total -gt 0 ] && total=`expr $total \* $isize / 512`
75 while [ $count -lt $total ]
77 count=`expr $count + 1`
78 cat >>$tmp.proto <<EOF
79 ${count}_of_${total}_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---755 3 1 /bin/true
85 # real QA test starts here
87 _supported_os IRIX Linux
92 # sanity test - default + one root directory entry
93 # Note: must do this proto/mkfs now for later inode size calcs
95 echo "=== one entry (shortform)"
96 _scratch_mkfs_xfs -p $tmp.proto >$tmp.mkfs0 2>&1
97 _filter_mkfs <$tmp.mkfs0 >/dev/null 2>$tmp.mkfs
101 # block-form root directory & repeat
103 echo "=== twenty entries (block form)"
104 _scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1
107 # leaf-form root directory & repeat
109 echo "=== thousand entries (leaf form)"
110 _scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1