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