generic/402: Drop useless fail message
[xfstests-dev.git] / tests / generic / 300
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3
4 #
5 # FSQA Test No. 300
6 #
7 # AIO/DIO stress test
8 # Run random AIO/DIO activity and fallocate/punch_hole simultaneously
9 # Test will operate on huge sparsed file so ENOSPC is expected.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 fio_config=$tmp.fio
18 status=1        # failure is the default!
19 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
20
21 # get standard environment, filters and checks
22 . ./common/rc
23 . ./common/filter
24
25 # real QA test starts here
26 _supported_fs generic
27 _require_scratch
28 _require_odirect
29 _require_block_device $SCRATCH_DEV
30
31 # xfs_io is not required for this test, but it's the best way to verify
32 # the test system supports fallocate() for allocation and hole punching
33 _require_xfs_io_command "falloc"
34 _require_xfs_io_command "fpunch"
35
36 rm -f $seqres.full
37
38 NUM_JOBS=$((4*LOAD_FACTOR))
39 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
40 if [ $((BLK_DEV_SIZE)) -gt 1048576 ]
41 then
42     BLK_DEV_SIZE=1048576
43 fi
44 FS_SIZE=$((BLK_DEV_SIZE * 512))
45
46 cat >$fio_config <<EOF
47 ###########
48 # $seq test fio activity
49 # Run DIO, fallocate and punch_hole threads on a single in parallel
50 #
51 # If race exist old dio request may rewrite punched block after it was
52 # allocated to another file, we will catch that by verifying blocks content
53 #
54 [global]
55 directory=${SCRATCH_MNT}
56 filesize=${FS_SIZE}
57 size=999G
58 continue_on_error=write
59 ignore_error=,ENOSPC
60 error_dump=0
61
62 create_on_open=1
63 fallocate=none
64 exitall=1
65
66 ## Perform direct aio, to files which may be truncated
67 ## by external task
68 [direct_aio_raicer]
69 ioengine=libaio
70 iodepth=128*${LOAD_FACTOR}
71 bs=128k
72 direct=1
73 numjobs=${NUM_JOBS}
74 rw=randwrite
75 runtime=100*${TIME_FACTOR}
76 time_based
77 filename=racer
78
79 # Run falloc and punch_hole threads in parallel
80 # After activity file will be highly fragmented
81 [falloc_raicer]
82 ioengine=falloc
83 runtime=100*${TIME_FACTOR}
84 iodepth=1
85 bssplit=128k/80:512k/10:32k/10
86 rw=randwrite
87 numjobs=1
88 filename=racer
89
90 [punch_hole_raicer]
91 ioengine=falloc
92 runtime=100*${TIME_FACTOR}
93 bs=4k
94 time_based=10
95 rw=randtrim
96 numjobs=2
97 filename=racer
98 time_based
99
100 # Verifier thread continiously write to newly allcated blocks
101 # and veryfy written content
102 [aio-dio-verifier]
103 ioengine=libaio
104 iodepth=128*${LOAD_FACTOR}
105 numjobs=1
106 verify=crc32c-intel
107 verify_fatal=1
108 verify_dump=1
109 verify_backlog=1024
110 verify_async=4
111 verifysort=1
112 direct=1
113 bs=4k
114 rw=randwrite
115 filename=aio-dio-verifier
116 EOF
117
118 _workout()
119 {
120         echo ""
121         echo "Run fio with random aio-dio pattern"
122         echo ""
123         cat $fio_config >>  $seqres.full
124         run_check $FIO_PROG $fio_config
125 }
126
127 _require_fio $fio_config
128
129 _scratch_mkfs_sized $FS_SIZE >> $seqres.full 2>&1
130 _scratch_mount
131
132 if ! _workout; then
133         _scratch_unmount 2>/dev/null
134         exit
135 fi
136
137 if ! _scratch_unmount; then
138         echo "failed to umount"
139         status=1
140         exit
141 fi
142 status=0
143 exit