2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved.
8 # Test if mkfs.xfs wipes old AG headers when using -f option
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # dd the 1st sector then repair
28 dd if=/dev/zero of=$1 bs=$2 count=1 2>&1 | _filter_dd
30 _scratch_xfs_repair 2>&1 | _filter_repair
32 if _check_scratch_fs; then
39 # get standard environment, filters and checks
44 # real QA test starts here
46 # Modify as appropriate.
50 # o Summary of testing:
51 # 1. mkfs.xfs a default filesystem, note agcount value.
52 # 2. dd zero first sector and repair and verify.
53 # 3. mkfs.xfs overriding agcount to a smaller value
54 # (ie. each AG is bigger)
55 # 4. dd zero first sector, repair and verify.
56 # -> old mkfs.xfs will cause repair to incorrectly
57 # fix filesystem, new mkfs.xfs will be fine.
60 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs \
61 || _fail "mkfs failed!"
63 # By executing the followint tmp file, will get on the mkfs options stored in
67 # if the default agcount is too small, bump it up and re-mkfs before testing
68 if [ $agcount -lt 8 ]; then
70 _scratch_mkfs_xfs -dagcount=$agcount >/dev/null 2>&1 \
71 || _notrun "Test requires at least 8 AGs."
74 _dd_repair_check $SCRATCH_DEV $sectsz
77 let "agcount=$agcount-2"
78 _scratch_mkfs_xfs -dagcount=$agcount >/dev/null 2>&1 \
79 || _fail "mkfs failed!"
81 _dd_repair_check $SCRATCH_DEV $sectsz