2010-01-20 10:27:08 +11:00
|
|
|
#! /bin/bash
|
2009-05-28 17:04:15 +02:00
|
|
|
# FS QA Test No. 104
|
|
|
|
|
#
|
|
|
|
|
# XFS online growfs-while-allocating tests (data subvol variant)
|
2005-01-12 13:53:32 +00:00
|
|
|
#
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
# Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
|
2009-05-12 13:24:15 -05:00
|
|
|
#
|
|
|
|
|
# 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
|
|
|
|
|
#
|
2005-01-12 13:53:32 +00:00
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
seq=`basename $0`
|
2013-03-15 12:28:02 +00:00
|
|
|
seqres=$RESULT_DIR/$seq
|
2005-01-12 13:53:32 +00:00
|
|
|
echo "QA output created by $seq"
|
|
|
|
|
|
|
|
|
|
here=`pwd`
|
|
|
|
|
tmp=/tmp/$$
|
|
|
|
|
status=1 # failure is the default!
|
|
|
|
|
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
|
|
|
|
|
|
|
|
|
|
# get standard environment, filters and checks
|
2013-03-15 12:28:04 +00:00
|
|
|
. ./common/rc
|
|
|
|
|
. ./common/filter
|
2005-01-12 13:53:32 +00:00
|
|
|
|
|
|
|
|
_create_scratch()
|
|
|
|
|
{
|
|
|
|
|
echo "*** mkfs"
|
2013-03-15 12:28:02 +00:00
|
|
|
_scratch_mkfs_xfs $@ | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
|
2005-01-12 13:53:32 +00:00
|
|
|
. $tmp.mkfs
|
|
|
|
|
|
|
|
|
|
echo "*** mount"
|
|
|
|
|
if ! _scratch_mount 2>/dev/null
|
|
|
|
|
then
|
|
|
|
|
echo "failed to mount $SCRATCH_DEV"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2010-03-06 11:25:10 +11:00
|
|
|
|
|
|
|
|
# fix the reserve block pool to a known size so that the enospc
|
|
|
|
|
# calculations work out correctly.
|
|
|
|
|
_scratch_resvblks 1024 > /dev/null 2>&1
|
2005-01-12 13:53:32 +00:00
|
|
|
}
|
2005-12-09 02:52:22 +00:00
|
|
|
|
2005-01-12 13:53:32 +00:00
|
|
|
_fill_scratch()
|
|
|
|
|
{
|
2005-06-02 15:09:19 +00:00
|
|
|
$XFS_IO_PROG -f -c "resvsp 0 ${1}" $SCRATCH_MNT/resvfile
|
2005-01-12 13:53:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_stress_scratch()
|
|
|
|
|
{
|
|
|
|
|
procs=3
|
|
|
|
|
nops=1000
|
|
|
|
|
# -w ensures that the only ops are ones which cause write I/O
|
2013-02-20 10:42:10 +00:00
|
|
|
FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs \
|
|
|
|
|
-n $nops $FSSTRESS_AVOID`
|
2013-03-15 12:28:02 +00:00
|
|
|
$FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full &
|
2005-01-12 13:53:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# real QA test starts here
|
|
|
|
|
_supported_fs xfs
|
|
|
|
|
_require_scratch
|
2016-05-09 16:03:27 +10:00
|
|
|
|
|
|
|
|
rm -f $seqres.full
|
2013-03-15 12:28:02 +00:00
|
|
|
_scratch_mkfs_xfs | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs
|
2005-01-12 13:53:32 +00:00
|
|
|
. $tmp.mkfs # extract blocksize and data size for scratch device
|
|
|
|
|
|
|
|
|
|
endsize=`expr 550 \* 1048576` # stop after growing this big
|
|
|
|
|
incsize=`expr 42 \* 1048576` # grow in chunks of this size
|
|
|
|
|
modsize=`expr 4 \* $incsize` # pause after this many increments
|
|
|
|
|
|
|
|
|
|
[ `expr $endsize / $dbsize` -lt $dblocks ] || _notrun "Scratch device too small"
|
|
|
|
|
|
|
|
|
|
nags=4
|
2015-03-18 14:54:08 +11:00
|
|
|
size=`expr 125 \* 1048576` # 120 megabytes initially
|
2005-01-12 13:53:32 +00:00
|
|
|
sizeb=`expr $size / $dbsize` # in data blocks
|
|
|
|
|
echo "*** creating scratch filesystem"
|
2015-03-18 14:54:08 +11:00
|
|
|
_create_scratch -lsize=10m -dsize=${size} -dagcount=${nags}
|
2005-01-12 13:53:32 +00:00
|
|
|
|
|
|
|
|
echo "*** using some initial space on scratch filesystem"
|
2016-05-25 22:57:08 -07:00
|
|
|
for i in `seq 125 -1 90`; do
|
|
|
|
|
fillsize=`expr $i \* 1048576`
|
|
|
|
|
out="$(_fill_scratch $fillsize 2>&1)"
|
|
|
|
|
echo "$out" | grep -q 'No space left on device' && continue
|
|
|
|
|
test -n "${out}" && echo "$out"
|
|
|
|
|
break
|
|
|
|
|
done
|
2005-01-12 13:53:32 +00:00
|
|
|
|
2005-12-09 02:52:22 +00:00
|
|
|
#
|
2005-01-12 13:53:32 +00:00
|
|
|
# Grow the filesystem while actively stressing it...
|
|
|
|
|
# Kick off more stress threads on each iteration, grow; repeat.
|
2005-12-09 02:52:22 +00:00
|
|
|
#
|
2005-01-12 13:53:32 +00:00
|
|
|
while [ $size -le $endsize ]; do
|
2015-03-18 14:54:08 +11:00
|
|
|
echo "*** stressing filesystem"
|
2013-03-15 12:28:02 +00:00
|
|
|
echo "*** stressing a ${sizeb} block filesystem" >> $seqres.full
|
2005-01-12 13:53:32 +00:00
|
|
|
_stress_scratch
|
|
|
|
|
sleep 1
|
|
|
|
|
size=`expr $size + $incsize`
|
|
|
|
|
sizeb=`expr $size / $dbsize` # in data blocks
|
2015-03-18 14:54:08 +11:00
|
|
|
echo "*** growing filesystem"
|
2013-03-15 12:28:02 +00:00
|
|
|
echo "*** growing to a ${sizeb} block filesystem" >> $seqres.full
|
2005-01-12 13:53:32 +00:00
|
|
|
xfs_growfs -D ${sizeb} $SCRATCH_MNT \
|
2013-03-15 12:28:02 +00:00
|
|
|
| tee -a $seqres.full | _filter_mkfs 2>$tmp.growfs
|
2005-01-12 13:53:32 +00:00
|
|
|
. $tmp.growfs
|
|
|
|
|
[ `expr $size % $modsize` -eq 0 ] && wait # every 4th iteration
|
2013-03-15 12:28:02 +00:00
|
|
|
echo AGCOUNT=$agcount | tee -a $seqres.full
|
|
|
|
|
echo && echo >> $seqres.full
|
2005-01-12 13:53:32 +00:00
|
|
|
done
|
|
|
|
|
wait # stop for any remaining stress processes
|
|
|
|
|
|
2015-12-21 18:07:43 +11:00
|
|
|
_scratch_unmount
|
2005-01-12 13:53:32 +00:00
|
|
|
|
|
|
|
|
status=0
|
|
|
|
|
exit
|