summaryrefslogtreecommitdiff
path: root/tests/xfs/450
blob: a2ba49dccb6cc772cb199819925923b5b8081afe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2018 Oracle, Inc.  All rights reserved.
#
# FS QA Test No. 450
#
# Make sure that the statfs b_avail counter doesn't change across remount
# after the rmapbt has grown in size.
#
. ./common/preamble
_begin_fstest auto quick rmap prealloc

# Import common functions.
. ./common/filter

# remove previous \$seqres.full before test

# real QA test starts here
_supported_fs xfs
_require_xfs_io_command "falloc"
_require_test_program "punch-alternating"
_require_xfs_scratch_rmapbt

_scratch_mkfs >> $seqres.full
_scratch_mount

# Make sure we allocate a big enough file such that punching out every other
# block will cause the rmapbt to expand by at least one block.
blksz=$(_get_file_block_size $SCRATCH_MNT)
nr_rmap_per_rmapbt=$(( (blksz - 56) / 24))
blks=$(( (nr_rmap_per_rmapbt + 2) * 2))
$XFS_IO_PROG -f -c "falloc 0 $((blks * blksz))" $SCRATCH_MNT/a >> $seqres.full
$here/src/punch-alternating $SCRATCH_MNT/a

# Do the stat counters change across the remount?
before=$(stat -f -c '%b %f' $SCRATCH_MNT)
_scratch_cycle_mount
after=$(stat -f -c '%b %f' $SCRATCH_MNT)

if [ "${before}" != "${after}" ]; then
	echo "counters changed: ${before} ${after}"
	echo "before: ${before}" >> $seqres.full
	echo "after: ${after}" >> $seqres.full
fi

echo "Silence is golden."

# success, all done
status=0
exit