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.
51 # o Summary of testing:
52 # 1. mkfs.xfs a default filesystem, note agcount value.
53 # 2. dd zero first sector and repair and verify.
54 # 3. mkfs.xfs overriding agcount to a smaller value
55 # (ie. each AG is bigger)
56 # 4. dd zero first sector, repair and verify.
57 # -> old mkfs.xfs will cause repair to incorrectly
58 # fix filesystem, new mkfs.xfs will be fine.
61 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs \
62 || _fail "mkfs failed!"
64 # By executing the followint tmp file, will get on the mkfs options stored in
68 # if the default agcount is too small, bump it up and re-mkfs before testing
69 if [ $agcount -lt 8 ]; then
71 _scratch_mkfs_xfs -dagcount=$agcount >/dev/null 2>&1 \
72 || _notrun "Test requires at least 8 AGs."
75 _dd_repair_check $SCRATCH_DEV $sectsz
78 let "agcount=$agcount-2"
79 _scratch_mkfs_xfs -dagcount=$agcount >/dev/null 2>&1 \
80 || _fail "mkfs failed!"
82 _dd_repair_check $SCRATCH_DEV $sectsz