2 # SPDX-License-Identifier: GPL-2.0
7 # Ext4 defragmentation stress test
8 # Several threads perform defragmentation at random position
9 # using 'inplace' mode (allocate and free blocks inside defrag event)
10 # which significantly improve load pressure on block allocator.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
21 # get standard environment, filters and checks
26 # real QA test starts here
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))))
37 cat >$fio_config <<EOF
38 # Common e4defrag regression tests
42 directory=${SCRATCH_MNT}
47 continue_on_error=write
48 ignore_error=,EINVAL:61
50 #################################
52 # Stress test defragmentation engine
53 # Several threads perform defragmentation at random position
54 # use inplace=1 will allocate and free blocks inside defrag event
55 # which highly increase defragmentation
64 numjobs=4*${LOAD_FACTOR}
65 runtime=30*${TIME_FACTOR}
83 runtime=30*${TIME_FACTOR}
91 echo " Start defragment activity"
93 cat $fio_config >> $seqres.full
94 run_check $FIO_PROG $fio_config
97 _require_fio $fio_config
100 _scratch_mkfs >> $seqres.full 2>&1
104 _scratch_unmount 2>/dev/null
108 if ! _scratch_unmount; then
109 echo "failed to umount"