generic: test for creating duplicate filenames in encrypted dir
[xfstests-dev.git] / tests / ext4 / 301
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3
4 #
5 # FSQA Test No. 301
6 #
7 # Ext4 defragmentation stress test
8 # Defragment file while other task does direct io
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 fio_config=$tmp.fio
16 status=1        # failure is the default!
17 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
18
19 # get standard environment, filters and checks
20 . ./common/rc
21 . ./common/filter
22 . ./common/defrag
23
24 # real QA test starts here
25 _supported_fs ext4
26 _require_scratch
27 _require_defrag
28 _require_odirect
29
30 NUM_JOBS=$((4*LOAD_FACTOR))
31 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
32 # We need space for 2 files (test file, and donor one)
33 # reserve 30% in order to avoid ENOSPC
34 FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 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
47 #################################
48 # Test1
49 # Defragment file while other task does direct io
50
51 # Continious sequential defrag activity
52 [defrag-4k]
53 ioengine=e4defrag
54 iodepth=1
55 bs=128k
56 donorname=test1.def
57 filename=test1
58 inplace=0
59 rw=write
60 numjobs=${NUM_JOBS}
61 runtime=30*${TIME_FACTOR}
62 time_based
63
64 # Verifier
65 [aio-dio-verifier]
66 ioengine=libaio
67 iodepth=128*${LOAD_FACTOR}
68 numjobs=1
69 verify=crc32c-intel
70 verify_fatal=1
71 verify_dump=1
72 verify_backlog=1024
73 verify_async=1
74 verifysort=1
75 direct=1
76 bs=64k
77 rw=randwrite
78 filename=test1
79 runtime=30*${TIME_FACTOR}
80 time_based
81 EOF
82
83 _workout()
84 {
85         echo ""
86         echo " Start defragment activity"
87         echo ""
88         cat $fio_config >>  $seqres.full
89         run_check $FIO_PROG $fio_config
90 }
91
92 _require_fio $fio_config
93
94 rm -f $seqres.full
95 _scratch_mkfs  >> $seqres.full 2>&1
96 _scratch_mount
97
98 if ! _workout; then
99         _scratch_unmount 2>/dev/null
100         exit
101 fi
102
103 if ! _scratch_unmount; then
104         echo "failed to umount"
105         status=1
106         exit
107 fi
108 status=0