2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2020 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test that after doing a memory mapped write to an empty file, a call to
8 # stat(2) reports a non-zero number of used blocks.
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
14 status=1 # failure is the default!
15 trap "_cleanup; exit \$status" 0 1 2 3 15
23 # get standard environment, filters and checks
27 # real QA test starts here
33 _scratch_mkfs >>$seqres.full 2>&1
36 $XFS_IO_PROG -f -c "truncate 64K" \
38 -c "mwrite -S 0xab 0 64K" \
40 $SCRATCH_MNT/foobar | _filter_xfs_io
42 blocks_used=$(stat -c %b $SCRATCH_MNT/foobar)
43 if [ $blocks_used -eq 0 ]; then
44 echo "error: stat(2) reported 0 used blocks"
47 echo "Silence is golden"