2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
7 # exercise xfs_repair - ensure repeated use doesn't corrupt
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
20 # get standard environment, filters and checks
27 echo "Repairing, round 0" >> $seqres.full
28 _scratch_xfs_repair 2>&1 | _filter_repair | tee -a $seqres.full >$tmp.0
31 echo "Repairing, iteration $i" | tee -a $seqres.full
32 _scratch_xfs_repair 2>&1 | _filter_repair >$tmp.$i
33 diff $tmp.0 $tmp.$i >> $seqres.full
35 echo "ERROR: repair round $i differs to round 0 (see $seqres.full)" | tee -a $seqres.full
38 # echo all interesting stuff...
40 s/(rebuilding directory inode) (\d+)/\1 INO/g;
41 s/internal log/<TYPEOF> log/g;
42 s/external log on \S+/<TYPEOF> log/g;
49 # prototype file to create various directory forms
55 # take inode size into account for non-shortform directories...
56 [ $total -gt 0 ] && total=`expr $total \* $isize / 512`
67 while [ $count -lt $total ]
70 cat >>$tmp.proto <<EOF
71 ${count}_of_${total}_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---755 3 1 /bin/true
77 # real QA test starts here
82 _require_no_large_scratch_dev
84 # sanity test - default + one root directory entry
85 # Note: must do this proto/mkfs now for later inode size calcs
87 echo "=== one entry (shortform)"
88 _scratch_mkfs_xfs -p $tmp.proto >$tmp.mkfs0 2>&1
89 _filter_mkfs <$tmp.mkfs0 >/dev/null 2>$tmp.mkfs
93 # block-form root directory & repeat
95 echo "=== twenty entries (block form)"
96 _scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1
99 # leaf-form root directory & repeat
101 echo "=== thousand entries (leaf form)"
102 _scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1