2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved.
7 # Test for file size consistency with append followed by umount/mount
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
25 _show_wrote_and_stat_only()
27 # filer out xfs_io bits we are interested in
29 if (/^wrote/) { print } ;
30 if (/^stat\.size/) { print } ;
34 # get standard environment, filters and checks
38 # real QA test starts here
44 _scratch_mkfs >>$seqres.full 2>&1 \
45 || _fail "mkfs scratch failed"
49 echo "# creating new file for io"
50 touch $SCRATCH_MNT/testfile
52 echo "# appending 15k to new file, sync every 5k"
53 $XFS_IO_PROG -a -c "pwrite 0 5k" -c "fsync" \
54 -c "pwrite 5k 5k" -c "fsync" \
55 -c "pwrite 10k 5k" -c "fsync" -c "stat" \
56 $SCRATCH_MNT/testfile \
57 | _show_wrote_and_stat_only
59 echo "# remounting scratch"
60 _scratch_cycle_mount >>$seqres.full 2>&1 \
61 || _fail "remount failed: $MOUNT_OPTIONS"
63 echo "# stating file to confirm correct size"
64 $XFS_IO_PROG -r -c "stat" $SCRATCH_MNT/testfile \
65 | _show_wrote_and_stat_only
67 echo "# appending 10 bytes to new file, sync at 5 bytes"
68 $XFS_IO_PROG -f -c "pwrite 0 5" -c s -c "pwrite 5 5" \
69 -c "stat" $SCRATCH_MNT/nextfile \
70 | _show_wrote_and_stat_only
72 echo "# remounting scratch"
73 _scratch_cycle_mount >>$seqres.full 2>&1 \
74 || _fail "remount failed: $MOUNT_OPTIONS"
76 echo "# stating file to confirm correct size"
77 $XFS_IO_PROG -r -c "stat" $SCRATCH_MNT/nextfile \
78 | _show_wrote_and_stat_only