common/rc: add _scratch_{u}mount_idmapped() helpers
[xfstests-dev.git] / tests / ext4 / 303
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3
4 #
5 # FSQA Test No. 303
6 #
7 # Ext4 defragmentation stress test
8 # Two defrag tasks use common donor file
9 #
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_fs ext4
27 _require_scratch
28 _require_defrag
29 _require_odirect
30
31 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
32 # We need space for 3 files (one donor file and two test files)
33 # Reserve space for 4 files in order to avoid ENOSPC
34 FILE_SIZE=$((BLK_DEV_SIZE * (512 / (3+1))))
35
36 cat >$fio_config <<EOF
37 # Common e4defrag regression tests
38 [global]
39 ioengine=ioe_e4defrag
40 iodepth=1
41 directory=${SCRATCH_MNT}
42 filesize=${FILE_SIZE}
43 size=999G
44 buffered=0
45 fadvise_hint=0
46 continue_on_error=write
47 ignore_error=,EBUSY
48
49 #################################
50 # Test3
51 # Two defrag tasks use common donor file
52 [defrag-1]
53 ioengine=e4defrag
54 iodepth=1
55 bs=128k
56 donorname=test3.def
57 filename=test31
58 inplace=0
59 rw=write
60 numjobs=${LOAD_FACTOR}
61 runtime=30*${TIME_FACTOR}
62 time_based
63
64 [defrag-2]
65 ioengine=e4defrag
66 iodepth=1
67 bs=128k
68 donorname=test3.def
69 filename=test32
70 inplace=0
71 rw=write
72 numjobs=${LOAD_FACTOR}
73 runtime=30*${TIME_FACTOR}
74 time_based
75
76 [aio-dio-verifier-1]
77 ioengine=libaio
78 iodepth=128*${LOAD_FACTOR}
79 numjobs=1
80 verify=crc32c-intel
81 verify_fatal=1
82 verify_dump=1
83 verify_backlog=1024
84 verify_async=1
85 verifysort=1
86 direct=1
87 bs=64k
88 rw=write
89 filename=test31
90 runtime=30*${TIME_FACTOR}
91 time_based
92
93 [aio-buffer-verifier-2]
94 ioengine=libaio
95 numjobs=1
96 verify=crc32c-intel
97 verify_fatal=1
98 verify_dump=1
99 verify_backlog=1024
100 verify_async=1
101 verifysort=1
102 buffered=1
103 bs=64k
104 rw=randrw
105 filename=test32
106 runtime=30*${TIME_FACTOR}
107 time_based
108
109 EOF
110
111 _workout()
112 {
113         echo ""
114         echo " Start defragment activity"
115         echo ""
116         cat $fio_config >>  $seqres.full
117         run_check $FIO_PROG $fio_config
118 }
119
120 _require_fio $fio_config
121
122 rm -f $seqres.full
123 _scratch_mkfs  >> $seqres.full 2>&1
124 _scratch_mount
125
126 if ! _workout; then
127         _scratch_unmount 2>/dev/null
128         exit
129 fi
130
131 if ! _scratch_unmount; then
132         echo "failed to umount"
133         status=1
134         exit
135 fi
136 status=0
137 exit