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 #-----------------------------------------------------------------------
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
43 echo "Repairing, round 0" >> $seqres.full
44 _scratch_xfs_repair 2>&1 | _filter_repair | tee -a $seqres.full >$tmp.0
47 echo "Repairing, iteration $i" | tee -a $seqres.full
48 _scratch_xfs_repair 2>&1 | _filter_repair >$tmp.$i
49 diff $tmp.0 $tmp.$i >> $seqres.full
51 echo "ERROR: repair round $i differs to round 0 (see $seqres.full)" | tee -a $seqres.full
54 # echo all interesting stuff...
56 s/(rebuilding directory inode) (\d+)/\1 INO/g;
57 s/internal log/<TYPEOF> log/g;
58 s/external log on \S+/<TYPEOF> log/g;
65 # prototype file to create various directory forms
71 # take inode size into account for non-shortform directories...
72 [ $total -gt 0 ] && total=`expr $total \* $isize / 512`
83 while [ $count -lt $total ]
86 cat >>$tmp.proto <<EOF
87 ${count}_of_${total}_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---755 3 1 /bin/true
93 # real QA test starts here
98 _require_no_large_scratch_dev
100 # sanity test - default + one root directory entry
101 # Note: must do this proto/mkfs now for later inode size calcs
103 echo "=== one entry (shortform)"
104 _scratch_mkfs_xfs -p $tmp.proto >$tmp.mkfs0 2>&1
105 _filter_mkfs <$tmp.mkfs0 >/dev/null 2>$tmp.mkfs
109 # block-form root directory & repeat
111 echo "=== twenty entries (block form)"
112 _scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1
115 # leaf-form root directory & repeat
117 echo "=== thousand entries (leaf form)"
118 _scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1