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.
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #-----------------------------------------------------------------------
27 seqres=$RESULT_DIR/$seq
28 echo "QA output created by $seq"
32 status=1 # failure is the default!
33 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
41 [ -z "$XFS_PARALLEL_REPAIR_PROG" ] && _notrun "parallel repair binary xfs_prepair is not installed"
43 # force use of parallel repair
44 export XFS_REPAIR_PROG=$XFS_PARALLEL_REPAIR_PROG
48 echo "Repairing, round 0" >> $seqres.full
49 _scratch_xfs_repair 2>&1 | _filter_repair | tee -a $seqres.full >$tmp.0
52 echo "Repairing, iteration $i" | tee -a $seqres.full
53 _scratch_xfs_repair 2>&1 | _filter_repair >$tmp.$i
54 diff $tmp.0 $tmp.$i >> $seqres.full
56 echo "ERROR: repair round $i differs to round 0 (see $seqres.full)" | tee -a $seqres.full
59 # echo all interesting stuff...
61 s/(rebuilding directory inode) (\d+)/\1 INO/g;
62 s/internal log/<TYPEOF> log/g;
63 s/external log on \S+/<TYPEOF> log/g;
70 # prototype file to create various directory forms
76 # take inode size into account for non-shortform directories...
77 [ $total -gt 0 ] && total=`expr $total \* $isize / 512`
88 while [ $count -lt $total ]
91 cat >>$tmp.proto <<EOF
92 ${count}_of_${total}_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---755 3 1 /bin/true
98 # real QA test starts here
100 _supported_os IRIX Linux
103 _require_no_large_scratch_dev
105 # sanity test - default + one root directory entry
106 # Note: must do this proto/mkfs now for later inode size calcs
108 echo "=== one entry (shortform)"
109 _scratch_mkfs_xfs -p $tmp.proto >$tmp.mkfs0 2>&1
110 _filter_mkfs <$tmp.mkfs0 >/dev/null 2>$tmp.mkfs
114 # block-form root directory & repeat
116 echo "=== twenty entries (block form)"
117 _scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1
120 # leaf-form root directory & repeat
122 echo "=== thousand entries (leaf form)"
123 _scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1