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 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
30 # remove previous $seqres.full before test
33 # real QA test starts here
38 _require_test_program "punch-alternating"
39 _require_xfs_io_error_injection "bmap_alloc_minlen_extent"
41 echo "Format and mount fs"
42 _scratch_mkfs_sized $((1024 * 1024 * 1024)) >> $seqres.full
43 _scratch_mount >> $seqres.full
45 # Disable realtime inherit flag (if any) on root directory so that space on data
46 # device gets fragmented rather than realtime device.
47 _xfs_force_bdev data $SCRATCH_MNT
49 bsize=$(_get_file_block_size $SCRATCH_MNT)
51 echo "Consume free space"
52 fillerdir=$SCRATCH_MNT/fillerdir
53 nr_free_blks=$(stat -f -c '%f' $SCRATCH_MNT)
54 nr_free_blks=$((nr_free_blks * 90 / 100))
56 _fill_fs $((bsize * nr_free_blks)) $fillerdir $bsize 0 >> $seqres.full 2>&1
58 echo "Create fragmented filesystem"
59 for dentry in $(ls -1 $fillerdir/); do
60 $here/src/punch-alternating $fillerdir/$dentry >> $seqres.full
63 echo "Inject bmap_alloc_minlen_extent error tag"
64 _scratch_inject_error bmap_alloc_minlen_extent 1
66 echo "Scale fsstress args"
67 args=$(_scale_fsstress_args -p $((LOAD_FACTOR * 75)) -n $((TIME_FACTOR * 1000)))
69 echo "Execute fsstress in background"
70 $FSSTRESS_PROG -d $SCRATCH_MNT $args \
84 -f dread=0 > /dev/null 2>&1