2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle. All Rights Reserved.
7 # Test detection & fixing of bad summary block counts at mount time.
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
28 # remove previous $seqres.full before test
31 # real QA test starts here
33 # Modify as appropriate.
37 echo "Format and mount"
38 _scratch_mkfs > $seqres.full 2>&1
39 _scratch_mount >> $seqres.full 2>&1
40 echo "test file" > $SCRATCH_MNT/testfile
44 dblocks=$(_scratch_xfs_get_metadata_field dblocks 'sb 0')
45 _scratch_xfs_set_metadata_field fdblocks $((dblocks * 2)) 'sb 0' > $seqres.full 2>&1
47 echo "Detection and Correction"
48 _scratch_mount >> $seqres.full 2>&1
49 avail=$(stat -c '%a' -f $SCRATCH_MNT)
50 total=$(stat -c '%b' -f $SCRATCH_MNT)
51 echo "avail: $avail" >> $seqres.full
52 echo "total: $total" >> $seqres.full
53 test "$avail" -gt "$total" && echo "free space bad: $avail > $total"