5 # Test if mkfs.xfs wipes old AG headers when using -f option
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #-----------------------------------------------------------------------
27 echo "QA output created by $seq"
31 status=1 # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 15
39 # dd the 1st sector then repair
43 dd if=/dev/zero of=$1 bs=$2 count=1 2>&1 | _filter_dd
45 _scratch_xfs_repair 2>&1 | _filter_repair
47 if _check_scratch_fs; then
54 # get standard environment, filters and checks
59 # real QA test starts here
61 # Modify as appropriate.
66 # o Summary of testing:
67 # 1. mkfs.xfs a default filesystem, note agcount value.
68 # 2. dd zero first sector and repair and verify.
69 # 3. mkfs.xfs overriding agcount to a smaller value
70 # (ie. each AG is bigger)
71 # 4. dd zero first sector, repair and verify.
72 # -> old mkfs.xfs will cause repair to incorrectly
73 # fix filesystem, new mkfs.xfs will be fine.
76 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs \
77 || _fail "mkfs failed!"
79 # By executing the followint tmp file, will get on the mkfs options stored in
83 # if the default agcount is too small, bump it up and re-mkfs before testing
84 if [ $agcount -lt 8 ]; then
86 _scratch_mkfs_xfs -dagcount=$agcount >/dev/null 2>&1 \
87 || _notrun "Test requires at least 8 AGs."
90 _dd_repair_check $SCRATCH_DEV $sectsz
93 let "agcount=$agcount-2"
94 _scratch_mkfs_xfs -dagcount=$agcount >/dev/null 2>&1 \
95 || _fail "mkfs failed!"
97 _dd_repair_check $SCRATCH_DEV $sectsz