2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2021 Chandan Babu R. All Rights Reserved.
7 # Execute fsstress with bmap_alloc_minlen_extent error tag enabled.
10 _begin_fstest auto stress
12 # Import common functions.
17 # real QA test starts here
22 _require_test_program "punch-alternating"
23 _require_xfs_io_error_injection "bmap_alloc_minlen_extent"
25 echo "Format and mount fs"
26 _scratch_mkfs_sized $((1024 * 1024 * 1024)) >> $seqres.full
27 _scratch_mount >> $seqres.full
29 # Disable realtime inherit flag (if any) on root directory so that space on data
30 # device gets fragmented rather than realtime device.
31 _xfs_force_bdev data $SCRATCH_MNT
33 bsize=$(_get_file_block_size $SCRATCH_MNT)
35 echo "Consume free space"
36 fillerdir=$SCRATCH_MNT/fillerdir
37 nr_free_blks=$(stat -f -c '%f' $SCRATCH_MNT)
38 nr_free_blks=$((nr_free_blks * 90 / 100))
40 _fill_fs $((bsize * nr_free_blks)) $fillerdir $bsize 0 >> $seqres.full 2>&1
42 echo "Create fragmented filesystem"
43 for dentry in $(ls -1 $fillerdir/); do
44 $here/src/punch-alternating $fillerdir/$dentry >> $seqres.full
47 echo "Inject bmap_alloc_minlen_extent error tag"
48 _scratch_inject_error bmap_alloc_minlen_extent 1
50 echo "Scale fsstress args"
51 args=$(_scale_fsstress_args -p $((LOAD_FACTOR * 75)) -n $((TIME_FACTOR * 1000)))
53 echo "Execute fsstress in background"
54 $FSSTRESS_PROG -d $SCRATCH_MNT $args \
68 -f dread=0 > /dev/null 2>&1