common/fuzzy: try to clear blocking flags first in _scratch_fuzz_modify
[xfstests-dev.git] / tests / ext4 / 302
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3
4 #
5 # FSQA Test No. 302
6 #
7 # Ext4 defragmentation stress test
8 # Perform defragmentation on file under buffered io
9 # while third task does direct io to donor file
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 fio_config=$tmp.fio
17 status=1        # failure is the default!
18 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
19
20 # get standard environment, filters and checks
21 . ./common/rc
22 . ./common/filter
23 . ./common/defrag
24
25 # real QA test starts here
26 _supported_os Linux
27 _supported_fs ext4
28 _require_scratch
29 _require_defrag
30 _require_odirect
31
32 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
33 # We need space for 2 files (test file, and donor one)
34 # reserve 30% in order to avoid ENOSPC
35 FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1))))
36
37 cat >$fio_config <<EOF
38 # Common e4defrag regression tests
39 [global]
40 ioengine=ioe_e4defrag
41 iodepth=1
42 directory=${SCRATCH_MNT}
43 filesize=${FILE_SIZE}
44 size=999G
45 buffered=0
46 fadvise_hint=0
47 continue_on_error=write
48 ignore_error=,EBUSY
49
50 ##########################################
51 # Test2
52 # Perform defragmentation on file under buffered io
53 # while third task does direct io to donor file
54 #
55 # Continuous sequential defrag activity
56 [defrag-4k]
57 stonewall
58 ioengine=e4defrag
59 iodepth=1
60 bs=128k
61 donorname=test2.def
62 filename=test2
63 inplace=0
64 rw=write
65 numjobs=${LOAD_FACTOR}
66 runtime=30*${TIME_FACTOR}
67 time_based
68
69 # Run DIO/AIO for donor file
70 [donor-file-fuzzer]
71 ioengine=libaio
72 iodepth=128*${LOAD_FACTOR}
73 numjobs=${LOAD_FACTOR}
74 verify=0
75 direct=1
76 bs=64k
77 rw=randwrite
78 filename=test2.def
79 runtime=30*${TIME_FACTOR}
80 time_based
81
82 # Verifier thread
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 buffered=1
94 bs=64k
95 rw=randrw
96 filename=test2
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 $fio_config >>  $seqres.full
108         run_check $FIO_PROG $fio_config
109 }
110
111 _require_fio $fio_config
112
113 rm -f $seqres.full
114 _scratch_mkfs  >> $seqres.full 2>&1
115 _scratch_mount
116
117 if ! _workout; then
118         _scratch_unmount 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 status=0
128 exit