4 # exercise xfs_repair - ensure repeated use doesn't corrupt
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
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 # link correct .out file
42 _link_out_file $seq.out
46 echo "Repairing, round 0" >> $seq.full
47 _scratch_xfs_repair 2>&1 | _filter_repair | tee -a $seq.full >$tmp.0
50 echo "Repairing, iteration $i" | tee -a $seq.full
51 _scratch_xfs_repair 2>&1 | _filter_repair >$tmp.$i
52 diff $tmp.0 $tmp.$i >> $seq.full
54 echo "ERROR: repair round $i differs to round 0 (see $seq.full)" | tee -a $seq.full
57 # echo all interesting stuff...
59 s/(rebuilding directory inode) (\d+)/\1 INO/g;
60 s/internal log/<TYPEOF> log/g;
61 s/external log on \S+/<TYPEOF> log/g;
68 # prototype file to create various directory forms
74 # take inode size into account for non-shortform directories...
75 [ $total -gt 0 ] && total=`expr $total \* $isize / 512`
86 while [ $count -lt $total ]
89 cat >>$tmp.proto <<EOF
90 ${count}_of_${total}_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---755 3 1 /bin/true
96 # real QA test starts here
98 _supported_os IRIX Linux
103 # sanity test - default + one root directory entry
104 # Note: must do this proto/mkfs now for later inode size calcs
106 echo "=== one entry (shortform)"
107 _scratch_mkfs_xfs -p $tmp.proto >$tmp.mkfs0 2>&1
108 _filter_mkfs <$tmp.mkfs0 >/dev/null 2>$tmp.mkfs
112 # block-form root directory & repeat
114 echo "=== twenty entries (block form)"
115 _scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1
118 # leaf-form root directory & repeat
120 echo "=== thousand entries (leaf form)"
121 _scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1