xfstests: cleanup duplicates in all tests
[xfstests-dev.git] / tests / ext4 / 304
1 #! /bin/bash
2 # FSQA Test No. 304
3 #
4 # Ext4 defragmentation stress test
5 # Several threads perform defragmentation at random position
6 # using 'inplace' mode (allocate and free blocks inside defrag event)
7 # which significantly improve load pressure on block allocator.
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
27 seq=`basename $0`
28 seqres=$RESULT_DIR/$seq
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 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 # Test4
67 # Stress test defragmentation engine
68 # Several threads perform defragmentation at random position
69 # use inplace=1 will allocate and free blocks inside defrag event
70 # which highly increase defragmentation
71 [defrag-fuzzer]
72 ioengine=e4defrag
73 iodepth=1
74 bs=8k
75 donorname=test4.def
76 filename=test4
77 inplace=1
78 rw=randwrite
79 numjobs=4*${LOAD_FACTOR}
80 runtime=30*${TIME_FACTOR}
81 time_based
82
83 [aio-dio-verifier]
84 ioengine=libaio
85 iodepth=128
86 iomem_align=4k
87 numjobs=1
88 verify=crc32c-intel
89 verify_fatal=1
90 verify_dump=1
91 verify_backlog=1024
92 verify_async=1
93 verifysort=1
94 direct=1
95 bs=64k
96 rw=write
97 filename=test4
98 runtime=30*${TIME_FACTOR}
99 time_based
100
101 EOF
102
103 _workout()
104 {
105         echo ""
106         echo " Start defragment activity"
107         echo ""
108         cat $tmp-$seq.fio >>  $seqres.full
109         run_check $FIO_PROG $tmp-$seq.fio
110 }
111
112 _require_fio $tmp-$seq.fio
113
114 _scratch_mkfs  >> $seqres.full 2>&1
115 _scratch_mount
116
117 if ! _workout; then
118         umount $SCRATCH_DEV 2>/dev/null
119         exit
120 fi
121
122 if ! _scratch_unmount; then
123         echo "failed to umount"
124         status=1
125         exit
126 fi
127 _check_scratch_fs
128 status=$?
129 exit