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