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 #-----------------------------------------------------------------------
26 owner=mohamedb@sgi.com
29 echo "QA output created by $seq"
33 status=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
41 # dd the 1st sector then repair
45 dd if=/dev/zero of=$1 bs=$2 count=1 2>&1 | _filter_dd
47 _scratch_xfs_repair 2>&1 | _filter_repair
49 if _check_scratch_fs; then
56 # get standard environment, filters and checks
61 # real QA test starts here
63 # Modify as appropriate.
68 # o Summary of testing:
69 # 1. mkfs.xfs a default filesystem, note agcount value.
70 # 2. dd zero first sector and repair and verify.
71 # 3. mkfs.xfs overriding agcount to a smaller value
72 # (ie. each AG is bigger)
73 # 4. dd zero first sector, repair and verify.
74 # -> old mkfs.xfs will cause repair to incorrectly
75 # fix filesystem, new mkfs.xfs will be fine.
78 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs \
79 || _fail "mkfs failed!"
81 # By executing the followint tmp file, will get on the mkfs options stored in
85 # if the default agcount is too small, bump it up and re-mkfs before testing
86 if [ $agcount -lt 8 ]; then
88 _scratch_mkfs_xfs -dagcount=$agcount >/dev/null 2>&1 \
89 || _notrun "Test requires at least 8 AGs."
92 _dd_repair_check $SCRATCH_DEV $sectsz
95 let "agcount=$agcount-2"
96 _scratch_mkfs_xfs -dagcount=$agcount >/dev/null 2>&1 \
97 || _fail "mkfs failed!"
99 _dd_repair_check $SCRATCH_DEV $sectsz