xfstests: don't assume that falloc_punch implies falloc in test 255
[xfstests-dev.git] / 303
1 #! /bin/bash
2 # FSQA Test No. 303
3 #
4 # Ext4 defragmentation stress test
5 # Two defrag tasks use common donor file
6 #
7 #-----------------------------------------------------------------------
8 # (c) 2013 Dmitry Monakhov
9 #
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms 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,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22 #
23 #-----------------------------------------------------------------------
24 #
25 # creator
26 owner=dmonakhov@openvz.org
27
28 seq=`basename $0`
29 echo "QA output created by $seq"
30
31 here=`pwd`
32 tmp=/tmp/$$
33 status=1        # failure is the default!
34 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
35
36 # get standard environment, filters and checks
37 . ./common.rc
38 . ./common.filter
39 . ./common.defrag
40
41 # real QA test starts here
42 _supported_os Linux
43 _supported_fs ext4
44 _need_to_be_root
45 _require_scratch
46 _require_defrag
47
48 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
49 # We need space for 3 files (one donor file and two test files)
50 # Reserve space for 4 files in order to avoid ENOSPC
51 FILE_SIZE=$((BLK_DEV_SIZE * (512 / (3+1))))
52
53 cat >$tmp-$seq.fio <<EOF
54 # Common e4defrag regression tests
55 [global]
56 ioengine=ioe_e4defrag
57 iodepth=1
58 directory=${SCRATCH_MNT}
59 filesize=${FILE_SIZE}
60 size=999G
61 buffered=0
62 fadvise_hint=0
63 group_reporting
64
65 #################################
66 # Test3
67 # Two defrag tasks use common donor file
68 [defrag-1]
69 ioengine=e4defrag
70 iodepth=1
71 bs=128k
72 donorname=test3.def
73 filename=test31
74 inplace=0
75 rw=write
76 numjobs=${LOAD_FACTOR}
77 runtime=30*${TIME_FACTOR}
78 time_based
79
80 [defrag-2]
81 ioengine=e4defrag
82 iodepth=1
83 bs=128k
84 donorname=test3.def
85 filename=test32
86 inplace=0
87 rw=write
88 numjobs=${LOAD_FACTOR}
89 runtime=30*${TIME_FACTOR}
90 time_based
91
92 [aio-dio-verifier-1]
93 ioengine=libaio
94 iodepth=128*${LOAD_FACTOR}
95 numjobs=1
96 verify=crc32c-intel
97 verify_fatal=1
98 verify_dump=1
99 verify_backlog=1024
100 verify_async=1
101 verifysort=1
102 direct=1
103 bs=64k
104 rw=write
105 filename=test31
106 runtime=30*${TIME_FACTOR}
107 time_based
108
109 [aio-buffer-verifier-2]
110 ioengine=libaio
111 numjobs=1
112 verify=crc32c-intel
113 verify_fatal=1
114 verify_dump=1
115 verify_backlog=1024
116 verify_async=1
117 verifysort=1
118 buffered=1
119 bs=64k
120 rw=randrw
121 filename=test32
122 runtime=30*${TIME_FACTOR}
123 time_based
124
125 EOF
126
127 _workout()
128 {
129         echo ""
130         echo " Start defragment activity"
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  >> $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