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 echo "QA output created by $seq"
30 status=1 # failure is the default!
31 trap "_cleanup; exit \$status" 0 1 2 3 15
40 # get standard environment, filters and checks
45 # real QA test starts here
53 # Remove xfs signature so -f isn't needed to re-mkfs
57 dd if=/dev/zero of=$device bs=4k count=1 &>/dev/null
62 echo "==================="
63 echo "mkfs with opts: $@" | sed -e "s,/dev/sd.,DEVICE,"
64 /sbin/mkfs.xfs $@ 2>/dev/null > $tmp.mkfs.full
70 cat $tmp.mkfs.full | _filter_mkfs >> $seq.full 2>$tmp.mkfs
72 echo "Got sector size: $sectsz"
73 device=`echo $@ | awk '{print $NF}'`
77 # === 4k physical 512b logical aligned
79 echo "==================="
80 echo "4k physical 512b logical aligned"
81 SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 512 0 128`
82 # sector size should default to 4k
83 _check_mkfs $SCSI_DEBUG_DEV
84 # blocksize smaller than physical sectorsize should revert to logical sectorsize
85 _check_mkfs -b size=2048 -f $SCSI_DEBUG_DEV
89 # === 4k physical 512b logical unaligned
91 echo "==================="
92 echo "4k physical 512b logical unaligned"
93 SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 512 1 128`
94 # should fail on misalignment
95 _check_mkfs $SCSI_DEBUG_DEV
96 # should fall back to logical sector size with force
97 _check_mkfs -f $SCSI_DEBUG_DEV
98 # with 4k sector specified should fail without force
99 _check_mkfs -s size=4096 $SCSI_DEBUG_DEV
100 # with 4k sector specified should fall back to logical sector size with force
101 _check_mkfs -s size=4096 -f $SCSI_DEBUG_DEV
105 # === hard 4k physical / 4k logical
107 echo "==================="
108 echo "hard 4k physical / 4k logical"
109 SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 4096 0 128`
110 # block size smaller than sector size should fail
111 _check_mkfs -b size=2048 $SCSI_DEBUG_DEV
112 # sector size smaller than physical sector size should fail
113 _check_mkfs -s size=512 $SCSI_DEBUG_DEV