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 _begin_fstest repair mkfs auto quick
13 # Import common functions.
19 echo "Repairing, round 0" >> $seqres.full
20 _scratch_xfs_repair 2>&1 | _filter_repair | tee -a $seqres.full >$tmp.0
23 echo "Repairing, iteration $i" | tee -a $seqres.full
24 _scratch_xfs_repair 2>&1 | _filter_repair >$tmp.$i
25 diff $tmp.0 $tmp.$i >> $seqres.full
27 echo "ERROR: repair round $i differs to round 0 (see $seqres.full)" | tee -a $seqres.full
30 # echo all interesting stuff...
32 s/(rebuilding directory inode) (\d+)/\1 INO/g;
33 s/internal log/<TYPEOF> log/g;
34 s/external log on \S+/<TYPEOF> log/g;
41 # prototype file to create various directory forms
47 # take inode size into account for non-shortform directories...
48 [ $total -gt 0 ] && total=`expr $total \* $isize / 512`
59 while [ $count -lt $total ]
62 cat >>$tmp.proto <<EOF
63 ${count}_of_${total}_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---755 3 1 /bin/true
69 # real QA test starts here
73 _require_no_large_scratch_dev
75 # mkfs cannot create a filesystem with protofiles if realtime is enabled, so
76 # don't run this test if the rtinherit is anywhere in the mkfs options.
77 echo "$MKFS_OPTIONS" | grep -q "rtinherit" && \
78 _notrun "Cannot mkfs with a protofile and -d rtinherit."
80 # sanity test - default + one root directory entry
81 # Note: must do this proto/mkfs now for later inode size calcs
83 echo "=== one entry (shortform)"
84 _scratch_mkfs_xfs -p $tmp.proto >$tmp.mkfs0 2>&1
85 _filter_mkfs <$tmp.mkfs0 >/dev/null 2>$tmp.mkfs
89 # block-form root directory & repeat
91 echo "=== twenty entries (block form)"
92 _scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1
95 # leaf-form root directory & repeat
97 echo "=== thousand entries (leaf form)"
98 _scratch_mkfs_xfs -p $tmp.proto | _filter_mkfs >/dev/null 2>&1