xfstests: don't assume that falloc_punch implies falloc in test 255
[xfstests-dev.git] / 300
1 #! /bin/bash
2 # FSQA Test No. 300
3 #
4 # AIO/DIO stress test
5 # Run random AIO/DIO activity and fallocate/punch_hole simultaneously
6 # Test will operate on huge sparsed file so ENOSPC is expected.
7 #
8 #-----------------------------------------------------------------------
9 # (c) 2013 Dmitry Monakhov
10 #
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
14 #
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23 #
24 #-----------------------------------------------------------------------
25 #
26 # creator
27 owner=dmonakhov@openvz.org
28
29 seq=`basename $0`
30 echo "QA output created by $seq"
31
32 here=`pwd`
33 tmp=/tmp/$$
34 status=1        # failure is the default!
35 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
36
37 # get standard environment, filters and checks
38 . ./common.rc
39 . ./common.filter
40
41 # real QA test starts here
42 _supported_fs generic
43 _supported_os Linux
44 _need_to_be_root
45 _require_scratch
46
47 NUM_JOBS=$((4*LOAD_FACTOR))
48 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
49 if [ $((BLK_DEV_SIZE)) -gt 1048576 ]
50 then
51     BLK_DEV_SIZE=1048576
52 fi
53 FS_SIZE=$((BLK_DEV_SIZE * 512))
54
55 cat >$tmp-$seq.fio <<EOF
56 ###########
57 # $seq test fio activity
58 # Run DIO, fallocate and punch_hole threads on a single in parallel
59 #
60 # If race exist old dio request may rewrite punched block after it was
61 # allocated to another file, we will catch that by verifying blocks content
62 #
63 [global]
64 directory=${SCRATCH_MNT}
65 filesize=${FS_SIZE}
66 size=999G
67 continue_on_error=write
68 ignore_error=,ENOSPC
69 error_dump=0
70
71 create_on_open=1
72 fallocate=none
73 exitall=1
74
75 ## Perform direct aio, to files which may be truncated
76 ## by external task
77 [direct_aio_raicer]
78 ioengine=libaio
79 iodepth=128*${LOAD_FACTOR}
80 bs=128k
81 direct=1
82 numjobs=${NUM_JOBS}
83 rw=randwrite
84 runtime=100*${TIME_FACTOR}
85 time_based
86 filename=racer
87
88 # Run falloc and punch_hole threads in parallel
89 # After activity file will be highly fragmented
90 [falloc_raicer]
91 ioengine=falloc
92 runtime=100*${TIME_FACTOR}
93 iodepth=1
94 bssplit=128k/80:512k/10:32k/10
95 rw=randwrite
96 numjobs=1
97 filename=racer
98
99 [punch_hole_raicer]
100 ioengine=falloc
101 runtime=100*${TIME_FACTOR}
102 bs=4k
103 time_based=10
104 rw=randtrim
105 numjobs=2
106 filename=racer
107 time_based
108
109 # Verifier thread continiously write to newly allcated blocks
110 # and veryfy written content
111 [aio-dio-verifier]
112 ioengine=libaio
113 iodepth=128*${LOAD_FACTOR}
114 numjobs=1
115 verify=crc32c-intel
116 verify_fatal=1
117 verify_dump=1
118 verify_backlog=1024
119 verify_async=4
120 verifysort=1
121 direct=1
122 bs=4k
123 rw=randwrite
124 filename=aio-dio-verifier
125 EOF
126
127 _workout()
128 {
129         echo ""
130         echo "Run fio with random aio-dio pattern"
131         echo ""
132         cat $tmp-$seq.fio >>  $seq.full
133         run_check $FIO_PROG $tmp-$seq.fio
134 }
135
136 _require_fio $tmp-$seq.fio
137
138 _scratch_mkfs_sized $FS_SIZE >> $seq.full 2>&1
139 _scratch_mount
140
141 if ! _workout; then
142         umount $SCRATCH_DEV 2>/dev/null
143         exit
144 fi
145
146 if ! _scratch_unmount; then
147         echo "failed to umount"
148         status=1
149         exit
150 fi
151 _check_scratch_fs
152 status=$?
153 exit