2010-01-20 10:27:08 +11:00
|
|
|
#! /bin/bash
|
2009-05-28 17:04:15 +02:00
|
|
|
# FS QA Test No. 071
|
2003-07-07 03:34:36 +00:00
|
|
|
#
|
2009-05-28 17:04:15 +02:00
|
|
|
# Exercise IO at large file offsets.
|
2003-07-07 03:34:36 +00:00
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
# Copyright (c) 2000-2003 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
|
|
|
|
|
#
|
2003-07-07 03:34:36 +00:00
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
|
2013-03-15 12:28:03 +00:00
|
|
|
seqfull=$0
|
2003-07-07 03:34:36 +00:00
|
|
|
seq=`basename $0`
|
2013-03-15 12:28:02 +00:00
|
|
|
seqres=$RESULT_DIR/$seq
|
2003-07-07 03:34:36 +00:00
|
|
|
echo "QA output created by $seq"
|
2013-03-15 12:28:02 +00:00
|
|
|
rm -f $seqres.full
|
2003-07-07 03:34:36 +00:00
|
|
|
|
|
|
|
|
here=`pwd`
|
|
|
|
|
tmp=/tmp/$$
|
|
|
|
|
status=1 # failure is the default!
|
|
|
|
|
|
|
|
|
|
_cleanup()
|
|
|
|
|
{
|
2004-06-15 07:32:36 +00:00
|
|
|
cd /
|
2003-07-07 03:34:36 +00:00
|
|
|
rm -f $tmp.*
|
2015-12-21 18:07:43 +11:00
|
|
|
_scratch_unmount 2>/dev/null
|
2003-07-07 03:34:36 +00:00
|
|
|
}
|
|
|
|
|
trap "_cleanup; 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
|
2003-07-07 03:34:36 +00:00
|
|
|
|
2012-03-15 10:25:46 +08:00
|
|
|
bitsperlong=`src/feature -w`
|
|
|
|
|
# link correct .out file
|
2013-03-15 12:28:03 +00:00
|
|
|
rm -f $seqfull.out
|
2012-03-15 10:25:46 +08:00
|
|
|
if [ "$bitsperlong" -eq 32 ]; then
|
2013-03-15 12:28:03 +00:00
|
|
|
ln -s $seq.out.32 $seqfull.out
|
2012-03-15 10:25:46 +08:00
|
|
|
else
|
2013-03-15 12:28:03 +00:00
|
|
|
ln -s $seq.out.64 $seqfull.out
|
2012-03-15 10:25:46 +08:00
|
|
|
fi
|
|
|
|
|
|
2003-07-22 04:27:19 +00:00
|
|
|
_filter_io()
|
|
|
|
|
{
|
2004-03-19 00:01:18 +00:00
|
|
|
sed -e "s/$dbsize/1FSB/g" -e '/.* ops; /d'
|
2003-07-22 04:27:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_filter_off()
|
|
|
|
|
{
|
|
|
|
|
sed -e "s/$1/<OFFSET>/g" | _filter_io
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-15 10:25:46 +08:00
|
|
|
_filter_pwrite()
|
|
|
|
|
{
|
2016-11-03 08:15:25 +11:00
|
|
|
sed -e "s/pwrite.*: Invalid argument/pwrite: File too large/g"
|
2012-03-15 10:25:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_filter_pread()
|
|
|
|
|
{
|
2016-11-03 08:15:25 +11:00
|
|
|
sed -e "s/pread.*: Invalid argument/read 0\/$bytes bytes at offset <OFFSET>/g" | _filter_io
|
2012-03-15 10:25:46 +08:00
|
|
|
}
|
|
|
|
|
|
2003-07-07 03:34:36 +00:00
|
|
|
write_block()
|
|
|
|
|
{
|
|
|
|
|
location=$1
|
2003-07-22 04:27:19 +00:00
|
|
|
words=$2
|
|
|
|
|
offset=$3
|
|
|
|
|
bytes=$4
|
|
|
|
|
direct=$5
|
2003-07-07 03:34:36 +00:00
|
|
|
|
|
|
|
|
[ `$direct` ] && flags=-d
|
|
|
|
|
|
2003-07-22 04:27:19 +00:00
|
|
|
echo "Writing $bytes bytes, offset is $words (direct=$direct)" | _filter_io
|
2013-03-15 12:28:02 +00:00
|
|
|
echo "Writing $bytes bytes at $location $words (direct=$direct)" >>$seqres.full
|
2005-06-02 15:09:19 +00:00
|
|
|
$XFS_IO_PROG -c "pwrite $offset 512" $flags $SCRATCH_MNT/$seq \
|
2013-03-15 12:28:02 +00:00
|
|
|
2>&1 | _filter_off $offset | tee -a $seqres.full | _filter_pwrite
|
|
|
|
|
xfs_bmap -v $SCRATCH_MNT/$seq >>$seqres.full
|
2003-07-07 03:34:36 +00:00
|
|
|
|
2003-07-22 04:27:19 +00:00
|
|
|
echo "Reading $bytes bytes (direct=$direct)" | _filter_io
|
2013-03-15 12:28:02 +00:00
|
|
|
echo "Reading $bytes bytes at $location (direct=$direct)" >>$seqres.full
|
2005-06-02 15:09:19 +00:00
|
|
|
$XFS_IO_PROG -c "pread $offset $bytes" $flags $SCRATCH_MNT/$seq \
|
2013-03-15 12:28:02 +00:00
|
|
|
2>&1 | _filter_off $offset | tee -a $seqres.full | _filter_pread
|
2003-07-22 04:27:19 +00:00
|
|
|
|
2013-03-15 12:28:02 +00:00
|
|
|
$XFS_IO_PROG -c "pread -v $offset $bytes" $flags $SCRATCH_MNT/$seq >>$seqres.full 2>&1
|
2003-07-07 03:34:36 +00:00
|
|
|
|
2013-03-15 12:28:02 +00:00
|
|
|
echo | tee -a $seqres.full
|
2003-07-07 03:34:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# real QA test starts here
|
2004-06-15 07:32:36 +00:00
|
|
|
_supported_fs xfs
|
2017-07-20 21:22:05 -07:00
|
|
|
_supported_os Linux
|
2004-06-15 07:32:36 +00:00
|
|
|
|
2005-06-03 06:07:55 +00:00
|
|
|
[ -n "$XFS_IO_PROG" ] || _notrun "xfs_io executable not found"
|
2004-06-15 07:32:36 +00:00
|
|
|
|
2003-07-07 03:34:36 +00:00
|
|
|
_require_scratch
|
|
|
|
|
_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
|
2004-06-15 07:32:36 +00:00
|
|
|
. $tmp.mkfs
|
2003-07-07 03:34:36 +00:00
|
|
|
echo
|
|
|
|
|
_scratch_mount
|
|
|
|
|
|
2003-07-22 04:27:19 +00:00
|
|
|
# Okay... filesize limit depends on blocksize, bits per long and
|
|
|
|
|
# also if large block device patch is enabled (can't dynamically
|
|
|
|
|
# check that, so use env var USE_LBD_PATCH to override default).
|
2012-03-15 10:25:46 +08:00
|
|
|
#
|
2003-07-22 04:27:19 +00:00
|
|
|
# Note:
|
|
|
|
|
# We check from 1Tb below our guessed limit to 1Tb above it, and
|
|
|
|
|
# see what happens for each 1Tb increment along the way (first
|
|
|
|
|
# half should succeed, second half should fail to create a file).
|
|
|
|
|
# So, number calculated here is not the actual limit, its a ways
|
|
|
|
|
# above that, hopefully.
|
2003-07-07 03:34:36 +00:00
|
|
|
|
2003-07-22 04:27:19 +00:00
|
|
|
if [ "$bitsperlong" -eq 32 ]; then
|
|
|
|
|
upperbound=`expr $dbsize / 512`
|
|
|
|
|
# which is 8(TB) for 4K, 4(TB) for 2k, ... etc.
|
|
|
|
|
[ "$USE_LBD_PATCH" = yes ] && upperbound=16
|
|
|
|
|
# limited by page cache index when LBD patch onboard.
|
|
|
|
|
else
|
2012-03-15 10:25:46 +08:00
|
|
|
upperbound=`echo 8 \* 1024 \* 1024 | bc`
|
2003-09-16 07:22:33 +00:00
|
|
|
# 8 exabytes (working in TBs below)
|
2003-07-22 04:27:19 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Step from (upperbound-1)(Tb) through (upperbound+1(Tb), &
|
|
|
|
|
# seeks/writes/reads on each boundary (using holey files) -
|
|
|
|
|
# 1byte back from the boundary, and 1FSB back from the same
|
|
|
|
|
# boundary (and stash xfs_bmap output), before moving onto
|
|
|
|
|
# each new test point.
|
2003-07-07 03:34:36 +00:00
|
|
|
|
2005-06-02 15:09:19 +00:00
|
|
|
$XFS_IO_PROG -c "truncate 0" -f $SCRATCH_MNT/$seq
|
2003-07-07 03:34:36 +00:00
|
|
|
|
2003-07-22 04:27:19 +00:00
|
|
|
oneTB=`echo 1024 \* 1024 \* 1024 \* 1024 | bc`
|
|
|
|
|
count=`expr $upperbound - 1`
|
|
|
|
|
upperbound=`expr $upperbound + 1`
|
|
|
|
|
|
|
|
|
|
while [ $count -le $upperbound ]
|
2003-07-07 03:34:36 +00:00
|
|
|
do
|
|
|
|
|
# buffered IO
|
|
|
|
|
offset=`echo $oneTB \* $count | bc`
|
2003-07-22 04:27:19 +00:00
|
|
|
write_block $count "+0" $offset 512 false
|
2003-07-07 03:34:36 +00:00
|
|
|
offset=`echo $oneTB \* $count \- 1 | bc`
|
2003-07-22 04:27:19 +00:00
|
|
|
write_block $count "minus 1 byte" $offset 512 false
|
2003-07-07 03:34:36 +00:00
|
|
|
offset=`echo $oneTB \* $count \- $dbsize | bc`
|
2003-07-22 04:27:19 +00:00
|
|
|
write_block $count "minus 1FSB" $offset 512 false
|
|
|
|
|
write_block $count "minus 1FSB" $offset 1 false
|
2003-07-07 03:34:36 +00:00
|
|
|
|
|
|
|
|
# direct IO
|
|
|
|
|
offset=`echo $oneTB \* $count | bc`
|
2003-07-22 04:27:19 +00:00
|
|
|
write_block $count "+0" $offset $dbsize true
|
2003-07-07 03:34:36 +00:00
|
|
|
offset=`echo $oneTB \* $count \- 1 | bc`
|
2003-07-22 04:27:19 +00:00
|
|
|
write_block $count "minus 1FSB" $offset $dbsize true
|
2003-07-07 03:34:36 +00:00
|
|
|
|
2003-07-22 04:27:19 +00:00
|
|
|
echo === Iterating, `expr $upperbound - $count` remains
|
|
|
|
|
echo
|
|
|
|
|
echo
|
2009-03-25 20:53:36 +01:00
|
|
|
let count=$count+1
|
2003-07-07 03:34:36 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# success, all done
|
|
|
|
|
status=0
|
|
|
|
|
exit
|