4 # Test for file size consistency with append followed by umount/mount
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved.
8 #-----------------------------------------------------------------------
14 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
28 _show_wrote_and_stat_only()
30 # filer out xfs_io bits we are interested in
32 if (/^wrote/) { print } ;
33 if (/^stat\.size/) { print } ;
37 # get standard environment, filters and checks
41 # real QA test starts here
47 _scratch_mkfs_xfs >>$seq.full 2>&1 \
48 || _fail "mkfs scratch failed"
50 _scratch_mount >>$seq.full 2>&1 \
51 || _fail "mount failed: $MOUNT_OPTIONS"
53 echo "# creating new file for io"
54 touch $SCRATCH_MNT/testfile
56 echo "# appending 15k to new file, sync every 5k"
57 xfs_io -a -c "pwrite 0 5k" -c "fsync" \
58 -c "pwrite 5k 5k" -c "fsync" \
59 -c "pwrite 10k 5k" -c "fsync" -c "stat" \
60 $SCRATCH_MNT/testfile \
61 | _show_wrote_and_stat_only
63 echo "# unmounting scratch"
64 umount $SCRATCH_MNT>>$seq.full 2>&1 \
65 || _fail "unmount failed"
67 echo "# mounting scratch"
68 _scratch_mount >>$seq.full 2>&1 \
69 || _fail "mount failed: $MOUNT_OPTIONS"
71 echo "# stating file to confirm correct size"
72 xfs_io -r -c "stat" $SCRATCH_MNT/testfile \
73 | _show_wrote_and_stat_only
75 echo "# appending 10 bytes to new file, sync at 5 bytes"
76 xfs_io -f -c "pwrite 0 5" -c s -c "pwrite 5 5" \
77 -c "stat" $SCRATCH_MNT/nextfile \
78 | _show_wrote_and_stat_only
80 echo "# unmounting scratch"
81 umount $SCRATCH_MNT>>$seq.full 2>&1 \
82 || _fail "unmount failed"
84 echo "# mounting scratch"
85 _scratch_mount >>$seq.full 2>&1 \
86 || _fail "mount failed: $MOUNT_OPTIONS"
88 echo "# stating file to confirm correct size"
89 xfs_io -r -c "stat" $SCRATCH_MNT/nextfile \
90 | _show_wrote_and_stat_only