common: kill _supported_os
[xfstests-dev.git] / tests / xfs / 450
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc.  All rights reserved.
4 #
5 # FS QA Test No. 450
6 #
7 # Make sure that the statfs b_avail counter doesn't change across remount
8 # after the rmapbt has grown in size.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 # remove previous \$seqres.full before test
30 rm -f $seqres.full
31
32 # real QA test starts here
33 _supported_fs xfs
34 _require_xfs_io_command "falloc"
35 _require_test_program "punch-alternating"
36 _require_xfs_scratch_rmapbt
37
38 _scratch_mkfs >> $seqres.full
39 _scratch_mount
40
41 # Make sure we allocate a big enough file such that punching out every other
42 # block will cause the rmapbt to expand by at least one block.
43 blksz=$(_get_file_block_size $SCRATCH_MNT)
44 nr_rmap_per_rmapbt=$(( (blksz - 56) / 24))
45 blks=$(( (nr_rmap_per_rmapbt + 2) * 2))
46 $XFS_IO_PROG -f -c "falloc 0 $((blks * blksz))" $SCRATCH_MNT/a >> $seqres.full
47 $here/src/punch-alternating $SCRATCH_MNT/a
48
49 # Do the stat counters change across the remount?
50 before=$(stat -f -c '%b %f' $SCRATCH_MNT)
51 _scratch_cycle_mount
52 after=$(stat -f -c '%b %f' $SCRATCH_MNT)
53
54 if [ "${before}" != "${after}" ]; then
55         echo "counters changed: ${before} ${after}"
56         echo "before: ${before}" >> $seqres.full
57         echo "after: ${after}" >> $seqres.full
58 fi
59
60 echo "Silence is golden."
61
62 # success, all done
63 status=0
64 exit