3 #-----------------------------------------------------------------------
4 # Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved.
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation.
10 # This program is distributed in the hope that it would be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #-----------------------------------------------------------------------
23 # Test for file size consistency with append followed by umount/mount
29 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
43 _show_wrote_and_stat_only()
45 # filer out xfs_io bits we are interested in
47 if (/^wrote/) { print } ;
48 if (/^stat\.size/) { print } ;
52 # get standard environment, filters and checks
56 # real QA test starts here
62 _scratch_mkfs_xfs >>$seq.full 2>&1 \
63 || _fail "mkfs scratch failed"
65 _scratch_mount >>$seq.full 2>&1 \
66 || _fail "mount failed: $MOUNT_OPTIONS"
68 echo "# creating new file for io"
69 touch $SCRATCH_MNT/testfile
71 echo "# appending 15k to new file, sync every 5k"
72 xfs_io -a -c "pwrite 0 5k" -c "fsync" \
73 -c "pwrite 5k 5k" -c "fsync" \
74 -c "pwrite 10k 5k" -c "fsync" -c "stat" \
75 $SCRATCH_MNT/testfile \
76 | _show_wrote_and_stat_only
78 echo "# unmounting scratch"
79 umount $SCRATCH_MNT>>$seq.full 2>&1 \
80 || _fail "unmount failed"
82 echo "# mounting scratch"
83 _scratch_mount >>$seq.full 2>&1 \
84 || _fail "mount failed: $MOUNT_OPTIONS"
86 echo "# stating file to confirm correct size"
87 xfs_io -r -c "stat" $SCRATCH_MNT/testfile \
88 | _show_wrote_and_stat_only
90 echo "# appending 10 bytes to new file, sync at 5 bytes"
91 xfs_io -f -c "pwrite 0 5" -c s -c "pwrite 5 5" \
92 -c "stat" $SCRATCH_MNT/nextfile \
93 | _show_wrote_and_stat_only
95 echo "# unmounting scratch"
96 umount $SCRATCH_MNT>>$seq.full 2>&1 \
97 || _fail "unmount failed"
99 echo "# mounting scratch"
100 _scratch_mount >>$seq.full 2>&1 \
101 || _fail "mount failed: $MOUNT_OPTIONS"
103 echo "# stating file to confirm correct size"
104 xfs_io -r -c "stat" $SCRATCH_MNT/nextfile \
105 | _show_wrote_and_stat_only