generic: test MADV_POPULATE_READ with IO errors
[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 . ./common/preamble
12 _begin_fstest auto aio enospc preallocrw stress punch
13
14 fio_config=$tmp.fio
15 fio_out=$tmp.fio.out
16
17 # Import common functions.
18 . ./common/filter
19
20 # real QA test starts here
21 _supported_fs generic
22 _require_scratch
23 _require_odirect
24 _require_aio
25 _require_block_device $SCRATCH_DEV
26
27 # xfs_io is not required for this test, but it's the best way to verify
28 # the test system supports fallocate() for allocation and hole punching
29 _require_xfs_io_command "falloc"
30 _require_xfs_io_command "fpunch"
31
32 NUM_JOBS=$((4*LOAD_FACTOR))
33 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
34 if [ $((BLK_DEV_SIZE)) -gt 1048576 ]; then
35         BLK_DEV_SIZE=1048576
36 fi
37 FS_SIZE=$((BLK_DEV_SIZE * 512))
38
39 cat >$fio_config <<EOF
40 ###########
41 # $seq test fio activity
42 # Run DIO, fallocate and punch_hole threads on a single in parallel
43 #
44 # If race exist old dio request may rewrite punched block after it was
45 # allocated to another file, we will catch that by verifying blocks content
46 #
47 [global]
48 directory=${SCRATCH_MNT}
49 filesize=${FS_SIZE}
50 size=999G
51 continue_on_error=write
52 ignore_error=,ENOSPC
53 error_dump=0
54
55 create_on_open=1
56 fallocate=none
57 exitall=1
58
59 ## Perform direct aio, to files which may be truncated
60 ## by external task
61 [direct_aio_raicer]
62 ioengine=libaio
63 iodepth=128*${LOAD_FACTOR}
64 bs=128k
65 direct=1
66 numjobs=${NUM_JOBS}
67 rw=randwrite
68 runtime=100*${TIME_FACTOR}
69 time_based
70 filename=racer
71
72 # Run falloc and punch_hole threads in parallel
73 # After activity file will be highly fragmented
74 [falloc_raicer]
75 ioengine=falloc
76 runtime=100*${TIME_FACTOR}
77 iodepth=1
78 bssplit=128k/80:512k/10:32k/10
79 rw=randwrite
80 numjobs=1
81 filename=racer
82
83 [punch_hole_raicer]
84 ioengine=falloc
85 runtime=100*${TIME_FACTOR}
86 bs=4k
87 time_based=10
88 rw=randtrim
89 numjobs=2
90 filename=racer
91 time_based
92
93 # Verifier thread continiously write to newly allcated blocks
94 # and veryfy written content
95 [aio-dio-verifier]
96 ioengine=libaio
97 iodepth=128*${LOAD_FACTOR}
98 numjobs=1
99 verify=crc32c-intel
100 verify_fatal=1
101 verify_dump=1
102 verify_backlog=1024
103 verify_async=4
104 verifysort=1
105 direct=1
106 bs=4k
107 rw=randwrite
108 filename=aio-dio-verifier
109 EOF
110
111 _require_fio $fio_config
112
113 _scratch_mkfs_sized $FS_SIZE >> $seqres.full 2>&1
114 _scratch_mount
115
116 echo ""
117 echo "Run fio with random aio-dio pattern"
118 echo ""
119 cat $fio_config >>  $seqres.full
120 $FIO_PROG $fio_config --output=$fio_out
121 cat $fio_out >> $seqres.full
122
123 status=0
124 exit