xfstests: move xfs specific tests out of top directory
[xfstests-dev.git] / 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 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 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
48 # We need space for 2 files (test file, and donor one)
49 # reserve 30% in order to avoid ENOSPC
50 FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1))))
51
52 cat >$tmp-$seq.fio <<EOF
53 # Common e4defrag regression tests
54 [global]
55 ioengine=ioe_e4defrag
56 iodepth=1
57 directory=${SCRATCH_MNT}
58 filesize=${FILE_SIZE}
59 size=999G
60 buffered=0
61 fadvise_hint=0
62 group_reporting
63
64 #################################
65 # Test4
66 # Stress test defragmentation engine
67 # Several threads perform defragmentation at random position
68 # use inplace=1 will allocate and free blocks inside defrag event
69 # which highly increase defragmentation
70 [defrag-fuzzer]
71 ioengine=e4defrag
72 iodepth=1
73 bs=8k
74 donorname=test4.def
75 filename=test4
76 inplace=1
77 rw=randwrite
78 numjobs=4*${LOAD_FACTOR}
79 runtime=30*${TIME_FACTOR}
80 time_based
81
82 [aio-dio-verifier]
83 ioengine=libaio
84 iodepth=128
85 iomem_align=4k
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=write
96 filename=test4
97 runtime=30*${TIME_FACTOR}
98 time_based
99
100 EOF
101
102 _workout()
103 {
104         echo ""
105         echo " Start defragment activity"
106         echo ""
107         cat $tmp-$seq.fio >>  $seq.full
108         run_check $FIO_PROG $tmp-$seq.fio
109 }
110
111 _require_fio $tmp-$seq.fio
112
113 _scratch_mkfs  >> $seq.full 2>&1
114 _scratch_mount
115
116 if ! _workout; then
117         umount $SCRATCH_DEV 2>/dev/null
118         exit
119 fi
120
121 if ! _scratch_unmount; then
122         echo "failed to umount"
123         status=1
124         exit
125 fi
126 _check_scratch_fs
127 status=$?
128 exit