4 # Ext4 defragmentation stress test
5 # Several threads perform defragmentation at random position
6 # using 'inplace' mode (allocate and free blocks inside defrag event)
7 # which significantly improve load pressure on block allocator.
8 #-----------------------------------------------------------------------
9 # (c) 2013 Dmitry Monakhov
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
37 # get standard environment, filters and checks
42 # real QA test starts here
48 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
49 # We need space for 2 files (test file, and donor one)
50 # reserve 30% in order to avoid ENOSPC
51 FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1))))
53 cat >$fio_config <<EOF
54 # Common e4defrag regression tests
58 directory=${SCRATCH_MNT}
63 continue_on_error=write
64 ignore_error=,EINVAL:61
66 #################################
68 # Stress test defragmentation engine
69 # Several threads perform defragmentation at random position
70 # use inplace=1 will allocate and free blocks inside defrag event
71 # which highly increase defragmentation
80 numjobs=4*${LOAD_FACTOR}
81 runtime=30*${TIME_FACTOR}
99 runtime=30*${TIME_FACTOR}
107 echo " Start defragment activity"
109 cat $fio_config >> $seqres.full
110 run_check $FIO_PROG $fio_config
113 _require_fio $fio_config
115 _scratch_mkfs >> $seqres.full 2>&1
119 _scratch_unmount 2>/dev/null
123 if ! _scratch_unmount; then
124 echo "failed to umount"