4 # Test mkfs.xfs against various types of devices with varying
5 # logical & physical sector sizes and offsets.
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2012 Red Hat, 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
22 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
31 status=1 # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 15
41 # get standard environment, filters and checks
46 # real QA test starts here
54 # Remove xfs signature so -f isn't needed to re-mkfs
58 dd if=/dev/zero of=$device bs=4k count=1 &>/dev/null
63 echo "==================="
64 echo "mkfs with opts: $@" | sed -e "s,$SCSI_DEBUG_DEV,DEVICE,"
65 $MKFS_XFS_PROG $@ 2>/dev/null > $tmp.mkfs.full
71 cat $tmp.mkfs.full | _filter_mkfs >> $seqres.full 2>$tmp.mkfs
73 echo "Got sector size: $sectsz"
74 device=`echo $@ | awk '{print $NF}'`
78 # === 4k physical 512b logical aligned
80 echo "==================="
81 echo "4k physical 512b logical aligned"
82 SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 512 0 128`
83 # sector size should default to 4k
84 _check_mkfs $SCSI_DEBUG_DEV
85 # blocksize smaller than physical sectorsize should revert to logical sectorsize
86 _check_mkfs -b size=2048 -f $SCSI_DEBUG_DEV
87 ) | tee -a $seqres.full
90 # === 4k physical 512b logical unaligned
92 echo "==================="
93 echo "4k physical 512b logical unaligned"
94 SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 512 1 128`
95 # should fail on misalignment
96 _check_mkfs $SCSI_DEBUG_DEV
97 # should fall back to logical sector size with force
98 _check_mkfs -f $SCSI_DEBUG_DEV
99 # with 4k sector specified should fail without force
100 _check_mkfs -s size=4096 $SCSI_DEBUG_DEV
101 # with 4k sector specified should fall back to logical sector size with force
102 _check_mkfs -s size=4096 -f $SCSI_DEBUG_DEV
103 ) | tee -a $seqres.full
106 # === hard 4k physical / 4k logical
108 echo "==================="
109 echo "hard 4k physical / 4k logical"
110 SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 4096 0 128`
111 # block size smaller than sector size should fail
112 _check_mkfs -b size=2048 $SCSI_DEBUG_DEV
113 # sector size smaller than physical sector size should fail
114 _check_mkfs -s size=512 $SCSI_DEBUG_DEV
115 ) | tee -a $seqres.full