Abstract out some common quota shell code, add project operation to fsstress.
[xfstests-dev.git] / 090
1 #! /bin/sh
2 # FS QA Test No. 090
3 #
4 # Exercise IO on the realtime device (direct, buffered, mmapd)
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
8
9 # This program is free software; you can redistribute it and/or modify it
10 # under the terms of version 2 of the GNU General Public License as
11 # published by the Free Software Foundation.
12
13 # This program is distributed in the hope that it would be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17 # Further, this software is distributed without any warranty that it is
18 # free of the rightful claim of any third person regarding infringement
19 # or the like.  Any license provided herein, whether implied or
20 # otherwise, applies only to this software file.  Patent licenses, if
21 # any, provided herein do not apply to combinations of this program with
22 # other software, or any other product whatsoever.
23
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write the Free Software Foundation, Inc., 59
26 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
27
28 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
29 # Mountain View, CA  94043, or:
30
31 # http://www.sgi.com 
32
33 # For further information regarding this notice, see: 
34
35 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
36 #-----------------------------------------------------------------------
37 #
38 # creator
39 owner=nathans@sgi.com
40
41 seq=`basename $0`
42 echo "QA output created by $seq"
43
44 here=`pwd`
45 tmp=/tmp/$$
46 status=1        # failure is the default!
47 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
48
49 # get standard environment, filters and checks
50 . ./common.rc
51 . ./common.filter
52
53 # real QA test starts here
54 _supported_fs xfs
55 _supported_os Linux
56 _require_realtime
57 _require_scratch
58
59 _filter_io()
60 {
61         sed -e '/.* ops; /d'
62 }
63
64 _create_scratch()
65 {
66         echo "*** mkfs"
67         if ! _scratch_mkfs_xfs >$tmp.out 2>&1
68         then
69                 cat $tmp.out
70                 echo "failed to mkfs $SCRATCH_DEV"
71                 exit 1
72         fi
73
74         echo "*** mount"
75         if ! _scratch_mount
76         then
77                 echo "failed to mount $SCRATCH_DEV"
78                 exit 1
79         fi
80 }
81
82 realtime_direct_aligned()
83 {
84         echo direct realtime writes, 4 files, 2m each, increasing offsets.
85         for i in 0 1 2 3
86         do
87                 xfs_io -fdxR $SCRATCH_MNT/rt-direct-$1-$i \
88                         -c "extsize $1" -c "pwrite ${i}m 1m" \
89                         | _filter_io
90         done
91         _check_scratch_fs
92 }
93
94 realtime_buffer_aligned()
95 {
96         echo buffered realtime writes, 4 files, 2m each, increasing offsets.
97         for i in 0 1 2 3
98         do
99                 xfs_io -fxR $SCRATCH_MNT/rt-buffera-$1-$i \
100                         -c "extsize $1" -c "pwrite ${i}m 1m" \
101                         | _filter_io
102         done
103         _check_scratch_fs
104 }
105
106 realtime_buffer_unaligned()
107 {
108         echo buffered realtime writes, 4 files, unaligned byte offsets/sizes.
109         for i in 0 1 2 3
110         do
111                 xfs_io -fxR $SCRATCH_MNT/rt-bufferu-$1-$i \
112                         -c "extsize $1" -c "pwrite $i 1" \
113                         | _filter_io
114         done
115         _check_scratch_fs
116 }
117
118 realtime_mmap_unaligned()
119 {
120         # mmap realtime writes, 4 files, unaligned byte offsets/sizes.
121         for i in 0 1 2 3
122         do
123                 xfs_io -fxR $SCRATCH_MNT/rt-mmap-$1-$i \
124                         -c "extsize $1" -c "pwrite $i 1" \
125                         | _filter_io
126         done
127         _check_scratch_fs
128 }
129
130
131 _create_scratch
132
133 realtime_direct_aligned 0
134 #realtime_direct_aligned 1m
135 realtime_buffer_aligned 0
136 #realtime_buffer_aligned 1m
137 realtime_buffer_unaligned 0
138 #realtime_buffer_unaligned 1m
139 #realtime_mmap_unaligned 0
140 #realtime_mmap_unaligned 1m
141
142 status=0
143 exit