Use larger sizes in this test, seems to trigger the deadlock more easily
[xfstests-dev.git] / 071
1 #! /bin/sh
2 # XFS QA Test No. 071
3 # $Id: 071,v 1.1 2003/07/07 03:34:36 fsgqa Exp $
4 #
5 # Exercise IO at large file offsets (just terabytes for now).
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
9
10 # This program is free software; you can redistribute it and/or modify it
11 # under the terms of version 2 of the GNU General Public License as
12 # published by the Free Software Foundation.
13
14 # This program is distributed in the hope that it would be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18 # Further, this software is distributed without any warranty that it is
19 # free of the rightful claim of any third person regarding infringement
20 # or the like.  Any license provided herein, whether implied or
21 # otherwise, applies only to this software file.  Patent licenses, if
22 # any, provided herein do not apply to combinations of this program with
23 # other software, or any other product whatsoever.
24
25 # You should have received a copy of the GNU General Public License along
26 # with this program; if not, write the Free Software Foundation, Inc., 59
27 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
28
29 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
30 # Mountain View, CA  94043, or:
31
32 # http://www.sgi.com 
33
34 # For further information regarding this notice, see: 
35
36 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
37 #-----------------------------------------------------------------------
38 #
39 # creator
40 owner=nathans@sgi.com
41
42 seq=`basename $0`
43 echo "QA output created by $seq"
44 rm -f $seq.full
45
46 here=`pwd`
47 tmp=/tmp/$$
48 status=1        # failure is the default!
49
50 _cleanup()
51 {
52     rm -f $tmp.*
53     umount $SCRATCH_DEV 2>/dev/null
54 }
55 trap "_cleanup; exit \$status" 0 1 2 3 15
56
57 # get standard environment, filters and checks
58 . ./common.rc
59 . ./common.filter
60
61 write_block()
62 {
63     location=$1
64     offset=$2
65     bytes=$3
66     direct=$4
67
68     [ `$direct` ] && flags=-d
69
70     echo "Writing $bytes bytes at $location (direct=$direct)" | tee -a $seq.full
71     xfs_io -c "pwrite $offset 512" $flags $SCRATCH_MNT/$seq
72
73     echo "Saving block map to $seq.full" | tee -a $seq.full
74     xfs_bmap -v $SCRATCH_MNT/$seq >>$seq.full
75
76     echo "Reading $bytes bytes at $location (direct=$direct)" | tee -a $seq.full
77     xfs_io -c "pread $offset $bytes" $flags $SCRATCH_MNT/$seq
78     xfs_io -c "pread -v $offset $bytes" $flags $SCRATCH_MNT/$seq >>$seq.full
79
80     echo | tee -a $seq.full
81 }
82
83 # real QA test starts here
84 _require_scratch
85 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
86 source $tmp.mkfs
87 echo
88 _scratch_mount
89
90 oneTB=`echo 1024 \* 1024 \* 1024 \* 1024 | bc`
91
92 # Step from 1Tb through 16Tb, doing seek/writes/reads on each
93 # boundary (using holey files), 1byte back from the boundary,
94 # and 1FSB back from the boundary (and xfs_bmaps all the way).
95
96 xfs_io -c "truncate 0" -f $SCRATCH_MNT/$seq
97
98 count=1
99 while [ $count -le 16 ]
100 do
101     # buffered IO
102     offset=`echo $oneTB \* $count | bc`
103     write_block "$count Tb" $offset 512 false
104     offset=`echo $oneTB \* $count \- 1 | bc`
105     write_block "$count Tb minus 1 byte" $offset 512 false
106     offset=`echo $oneTB \* $count \- $dbsize | bc`
107     write_block "$count Tb minus 1 FSB" $offset 512 false
108
109     # direct IO
110     offset=`echo $oneTB \* $count | bc`
111     write_block "$count Tb" $offset $dbsize true
112     offset=`echo $oneTB \* $count \- 1 | bc`
113     write_block "$count Tb minus 1 FSB" $offset $dbsize true
114
115     count=`expr $count + 1`
116 done
117
118 # success, all done
119 status=0
120 exit