2010-01-20 10:27:08 +11:00
|
|
|
#! /bin/bash
|
2009-05-28 17:04:15 +02:00
|
|
|
# FS QA Test No. 096
|
|
|
|
|
#
|
|
|
|
|
# test out mkfs_xfs output on IRIX/Linux and some of its error handling
|
|
|
|
|
# ensure pv#920679 is addressed
|
2009-05-12 13:24:15 -05:00
|
|
|
#
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
# Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
|
|
|
|
|
#
|
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
|
# modify it under the terms of the GNU General Public License as
|
|
|
|
|
# published by the Free Software Foundation.
|
|
|
|
|
#
|
|
|
|
|
# This program is distributed in the hope that it would be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program; if not, write the Free Software Foundation,
|
|
|
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
#
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
#
|
2004-09-07 08:39:57 +00:00
|
|
|
|
2013-03-15 12:28:03 +00:00
|
|
|
seqfull=$0
|
2004-09-07 08:39:57 +00:00
|
|
|
seq=`basename $0`
|
2013-03-15 12:28:02 +00:00
|
|
|
seqres=$RESULT_DIR/$seq
|
2004-09-07 08:39:57 +00:00
|
|
|
echo "QA output created by $seq"
|
|
|
|
|
|
|
|
|
|
here=`pwd`
|
|
|
|
|
tmp=/tmp/$$
|
|
|
|
|
status=1 # failure is the default!
|
|
|
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
|
|
|
|
|
|
_cleanup()
|
|
|
|
|
{
|
|
|
|
|
cd /
|
|
|
|
|
rm -f $tmp.*
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# get standard environment, filters and checks
|
2013-03-15 12:28:04 +00:00
|
|
|
. ./common/rc
|
|
|
|
|
. ./common/filter
|
|
|
|
|
. ./common/log
|
2004-09-07 08:39:57 +00:00
|
|
|
|
2005-12-09 02:52:22 +00:00
|
|
|
#
|
2004-09-07 08:39:57 +00:00
|
|
|
# filter out counts which will vary
|
2006-08-22 03:55:04 +00:00
|
|
|
# - extsz, blocks, agsize, agcount, device name, rtextents
|
2015-03-18 14:54:30 +11:00
|
|
|
# - log version varies for crc enabled fs
|
|
|
|
|
# - lsunit varies for 512/4k sector devices
|
2004-09-07 08:39:57 +00:00
|
|
|
# filter out differences between linux and irix:
|
|
|
|
|
# - sectsz on Linux
|
|
|
|
|
# - mmr, mixed-case on IRIX
|
2005-06-02 03:48:53 +00:00
|
|
|
# - lazy-count on IRIX
|
|
|
|
|
# - inode-paths on IRIX
|
2004-09-07 08:39:57 +00:00
|
|
|
# - trailing spaces on Linux but not on IRIX
|
|
|
|
|
#
|
2005-06-03 15:11:17 +00:00
|
|
|
# Example output:
|
|
|
|
|
# meta-data=DEV isize=256 agcount=N, agsize=N blks
|
|
|
|
|
# data = bsize=4096 blocks=N, imaxpct=25
|
|
|
|
|
# = sunit=65 swidth=65 blks, unwritten=1
|
|
|
|
|
# naming =version 2 bsize=4096
|
|
|
|
|
# log =internal log bsize=4096 blocks=N, version=1
|
|
|
|
|
# = sunit=0 blks
|
2006-06-26 06:08:16 +00:00
|
|
|
# realtime =none extsz=65536 blocks=N, rtextents=N
|
2005-12-09 02:52:22 +00:00
|
|
|
#
|
2015-03-18 14:54:30 +11:00
|
|
|
mkfs_filter()
|
2004-09-07 08:39:57 +00:00
|
|
|
{
|
2013-03-15 12:28:02 +00:00
|
|
|
tee -a $seqres.full | \
|
2004-09-07 08:39:57 +00:00
|
|
|
sed \
|
2006-08-28 06:07:58 +00:00
|
|
|
-e 's/extsz=[0-9][0-9]*[ ]*/extsz=N, /' \
|
2004-09-07 08:39:57 +00:00
|
|
|
-e 's/blocks=[0-9][0-9]*/blocks=N/' \
|
2009-04-23 12:33:03 -05:00
|
|
|
-e 's/imaxpct=[0-9][0-9]*/imaxpct=N/' \
|
2004-09-07 08:39:57 +00:00
|
|
|
-e 's/agsize=[0-9][0-9]*/agsize=N/' \
|
|
|
|
|
-e 's/agcount=[0-9][0-9]*/agcount=N/' \
|
2007-11-30 03:07:14 +00:00
|
|
|
-e 's/swidth=[0-9][0-9]* blks$/&, unwritten=1/' \
|
2006-06-26 06:08:16 +00:00
|
|
|
-e 's/rtextents=[0-9][0-9]*/rtextents=N/' \
|
2004-09-07 08:39:57 +00:00
|
|
|
-e 's/meta-data=[^ ]*/meta-data=DEV/' \
|
2015-05-14 12:20:11 +10:00
|
|
|
-e 's/ *isize=[0-9]* / isize=N /' \
|
2008-12-01 14:09:30 +00:00
|
|
|
-e '/ *= *sectsz=[0-9][0-9]* *attr=[0-9][0-9]*.*$/d' \
|
2004-09-07 08:39:57 +00:00
|
|
|
-e '/ *= *mmr=[0-9][0-9]* *$/d' \
|
|
|
|
|
-e 's/ *mixed-case=[YN]//' \
|
2008-08-28 04:09:33 +00:00
|
|
|
-e 's/ *ascii-ci=[01]//' \
|
2015-03-18 14:54:30 +11:00
|
|
|
-e 's/\(version=\)\([12]\)/\1N/' \
|
|
|
|
|
-e 's/\(sunit=\)\([018] blks\)/\1N blks/' \
|
2004-09-07 08:39:57 +00:00
|
|
|
-e 's/sectsz=[0-9][0-9]* *//' \
|
2005-06-02 03:48:53 +00:00
|
|
|
-e 's/, lazy-count.*//' \
|
|
|
|
|
-e '/inode-paths/d' \
|
2005-06-03 15:11:17 +00:00
|
|
|
-e 's/\(log[ ]*=\).*bsize/\1LOG bsize/' \
|
2006-06-29 03:50:18 +00:00
|
|
|
-e 's/\(realtime[ ]*=\).*extsz/\1REALTIME extsz/' \
|
2013-03-15 11:53:19 +00:00
|
|
|
-e '/.*crc=/d' \
|
2005-11-16 02:49:46 +00:00
|
|
|
-e 's/ *$//' \
|
2013-10-30 03:58:55 +00:00
|
|
|
-e 's/ ftype=[01]//' \
|
2014-12-12 10:55:15 +11:00
|
|
|
-e '/^log stripe unit.*too large/d' \
|
|
|
|
|
-e '/^log stripe unit adjusted/d' \
|
2005-11-16 02:49:46 +00:00
|
|
|
| grep -v parent
|
2004-09-07 08:39:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# real QA test starts here
|
2013-03-15 12:28:02 +00:00
|
|
|
rm -f $seqres.full
|
2004-09-07 08:39:57 +00:00
|
|
|
|
|
|
|
|
# Modify as appropriate.
|
|
|
|
|
_supported_fs xfs
|
|
|
|
|
_supported_os IRIX Linux
|
|
|
|
|
_require_scratch
|
|
|
|
|
_require_v2log
|
2016-07-14 14:43:33 +02:00
|
|
|
_require_xfs_mkfs_without_validation
|
2004-09-07 08:39:57 +00:00
|
|
|
|
2005-07-11 14:56:55 +00:00
|
|
|
# choose .out file based on internal/external log
|
2013-03-15 12:28:03 +00:00
|
|
|
rm -f $seqfull.out
|
2005-07-11 14:56:55 +00:00
|
|
|
if [ "$USE_EXTERNAL" = yes ]; then
|
2016-03-23 17:39:11 +11:00
|
|
|
ln -s $seq.out.external $seqfull.out
|
2005-07-11 14:56:55 +00:00
|
|
|
else
|
2016-03-23 17:39:11 +11:00
|
|
|
ln -s $seq.out.internal $seqfull.out
|
2005-07-11 14:56:55 +00:00
|
|
|
fi
|
|
|
|
|
|
2004-09-07 08:39:57 +00:00
|
|
|
# maximum log record size
|
|
|
|
|
max_lr_size=`expr 256 \* 1024`
|
|
|
|
|
|
|
|
|
|
big_su=`expr $max_lr_size + 4096`
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Test out various mkfs param combinations
|
|
|
|
|
#
|
|
|
|
|
cat >$tmp.seq.params <<EOF
|
|
|
|
|
# su too big but must be a multiple of fs block size too
|
|
|
|
|
-l version=2,su=`expr $max_lr_size + 512`
|
|
|
|
|
# test log stripe greater than LR size
|
|
|
|
|
-l version=2,su=$big_su
|
|
|
|
|
# same test but get log stripe from data stripe
|
|
|
|
|
-l version=2 -d su=$big_su,sw=1
|
|
|
|
|
# test out data stripe
|
2015-05-14 12:20:11 +10:00
|
|
|
-m crc=0 -l version=1 -d su=$big_su,sw=1
|
2004-09-07 08:39:57 +00:00
|
|
|
# test out data stripe the same but using sunit & swidth
|
2015-05-14 12:20:11 +10:00
|
|
|
-m crc=0 -l version=1 -d sunit=`expr $big_su / 512`,swidth=`expr $big_su / 512`
|
2004-09-07 08:39:57 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# call mkfs in a loop for various params
|
|
|
|
|
#
|
|
|
|
|
echo ""
|
|
|
|
|
cat $tmp.seq.params \
|
|
|
|
|
| while read mkfs
|
|
|
|
|
do
|
|
|
|
|
if echo $mkfs | grep -q '^#'; then
|
|
|
|
|
# print out header & ignore comment
|
|
|
|
|
echo $mkfs
|
|
|
|
|
continue
|
|
|
|
|
fi
|
|
|
|
|
echo "--- mkfs=$mkfs ---"
|
|
|
|
|
export MKFS_OPTIONS="$mkfs"
|
2015-03-18 14:54:30 +11:00
|
|
|
_scratch_mkfs_xfs 2>&1 | mkfs_filter
|
2004-09-07 08:39:57 +00:00
|
|
|
echo ""
|
|
|
|
|
echo ""
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# success, all done
|
|
|
|
|
status=0
|
|
|
|
|
exit
|