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
43 _scratch_mkfs >>$seqres.full 2>&1 \
44 || _fail "mkfs scratch failed"
48 echo "# creating new file for io"
49 touch $SCRATCH_MNT/testfile
51 echo "# appending 15k to new file, sync every 5k"
52 $XFS_IO_PROG -a -c "pwrite 0 5k" -c "fsync" \
53 -c "pwrite 5k 5k" -c "fsync" \
54 -c "pwrite 10k 5k" -c "fsync" -c "stat" \
55 $SCRATCH_MNT/testfile \
56 | _show_wrote_and_stat_only
58 echo "# remounting scratch"
59 _scratch_cycle_mount >>$seqres.full 2>&1 \
60 || _fail "remount failed: $MOUNT_OPTIONS"
62 echo "# stating file to confirm correct size"
63 $XFS_IO_PROG -r -c "stat" $SCRATCH_MNT/testfile \
64 | _show_wrote_and_stat_only
66 echo "# appending 10 bytes to new file, sync at 5 bytes"
67 $XFS_IO_PROG -f -c "pwrite 0 5" -c s -c "pwrite 5 5" \
68 -c "stat" $SCRATCH_MNT/nextfile \
69 | _show_wrote_and_stat_only
71 echo "# remounting scratch"
72 _scratch_cycle_mount >>$seqres.full 2>&1 \
73 || _fail "remount failed: $MOUNT_OPTIONS"
75 echo "# stating file to confirm correct size"
76 $XFS_IO_PROG -r -c "stat" $SCRATCH_MNT/nextfile \
77 | _show_wrote_and_stat_only