xfs/007: fix regressions on V4 filesystems
[xfstests-dev.git] / tests / xfs / 538
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2021 Chandan Babu R.  All Rights Reserved.
4 #
5 # FS QA Test 538
6 #
7 # Execute fsstress with bmap_alloc_minlen_extent error tag enabled.
8 #
9 . ./common/preamble
10 _begin_fstest auto stress
11
12 # Import common functions.
13 . ./common/filter
14 . ./common/inject
15 . ./common/populate
16
17 # real QA test starts here
18
19 _supported_fs xfs
20 _require_scratch
21 _require_xfs_debug
22 _require_test_program "punch-alternating"
23 _require_xfs_io_error_injection "bmap_alloc_minlen_extent"
24
25 echo "Format and mount fs"
26 _scratch_mkfs_sized $((1024 * 1024 * 1024)) >> $seqres.full
27 _scratch_mount >> $seqres.full
28
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
32
33 bsize=$(_get_file_block_size $SCRATCH_MNT)
34
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))
39
40 _fill_fs $((bsize * nr_free_blks)) $fillerdir $bsize 0 >> $seqres.full 2>&1
41
42 echo "Create fragmented filesystem"
43 for dentry in $(ls -1 $fillerdir/); do
44         $here/src/punch-alternating $fillerdir/$dentry >> $seqres.full
45 done
46
47 echo "Inject bmap_alloc_minlen_extent error tag"
48 _scratch_inject_error bmap_alloc_minlen_extent 1
49
50 echo "Scale fsstress args"
51 args=$(_scale_fsstress_args -p $((LOAD_FACTOR * 75)) -n $((TIME_FACTOR * 1000)))
52
53 echo "Execute fsstress in background"
54 $FSSTRESS_PROG -d $SCRATCH_MNT $args \
55                  -f bulkstat=0 \
56                  -f bulkstat1=0 \
57                  -f fiemap=0 \
58                  -f getattr=0 \
59                  -f getdents=0 \
60                  -f getfattr=0 \
61                  -f listfattr=0 \
62                  -f mread=0 \
63                  -f read=0 \
64                  -f readlink=0 \
65                  -f readv=0 \
66                  -f stat=0 \
67                  -f aread=0 \
68                  -f dread=0 > /dev/null 2>&1
69
70 # success, all done
71 status=0
72 exit