xfs: no excessive warnings about dprecated mount options on remount
[xfstests-dev.git] / tests / xfs / 165
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2007 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 165
6 #
7 # Test out prealloc, direct writes and buffered read
8 # Some experimentation when looking at 
9 #   pv#962014 - DMF 3.7 reading incorrect data 
10 # Doesn't actually reproduce the problem but it tried to :-)
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23     cd /
24     rm -f $tmp.*
25 }
26
27 _filter_io()
28 {
29     tee -a $seqres.full | _filter_xfs_io
30 }
31
32 #
33 # <    1: [8..79]:         6552..6623        0 (6552..6623)        72
34 # >    1: [8..79]:         202544..202615    0 (202544..202615)    72
35 #
36 _filter_bmap()
37 {
38     awk '$3 ~ /hole/ { print $1, $2, $3; next }
39          {print $1, $2}' >> $seqres.full
40 }
41
42 # get standard environment, filters and checks
43 . ./common/rc
44 . ./common/filter
45
46 # real QA test starts here
47
48 # Modify as appropriate.
49 _supported_fs xfs
50 _require_test
51 _require_xfs_io_command "falloc"
52
53 # io tests 
54 testfile=$TEST_DIR/file.$seq
55 rm -f $testfile
56 rm -f $seqres.full
57 len=4
58 end=`expr 10 \* $len`
59
60 # Other test...
61 #$XFS_IO_PROG -f -c "resvsp ${off}k ${end}k" $testfile
62
63 # write the initial file
64 $XFS_IO_PROG -f -c "pwrite 0  ${end}k" $testfile | _filter_io
65
66 off=0
67 while [ $off -le $end ]
68 do
69         offset=${off}k
70         length=${len}k
71
72         $XFS_IO_PROG -c "unresvsp $offset $length" -c "bmap -vp" $testfile | _filter_bmap
73
74         let off=$off+$len # skip over 1
75         let off=$off+$len
76 done
77
78 off=0
79 while [ $off -le $end ]
80 do
81         offset=${off}k
82         length=${len}k
83         bufsize=${len}k
84         echo ""
85         echo "*** offset = $offset ***"
86         echo ""
87
88         # prealloc and write
89         $XFS_IO_PROG -d -c "resvsp $offset $length" -c "pwrite -b $bufsize $offset $length" $testfile | _filter_io
90
91         # Other tests...
92         #$XFS_IO_PROG -c "resvsp $offset $length" $testfile
93         #xfs_bmap -v -p $testfile
94         #$XFS_IO_PROG -d -c "pwrite -b $bufsize $offset $length" $testfile
95         #xfs_bmap -v -p $testfile
96
97         $XFS_IO_PROG -r -c "pread -v -b $bufsize $offset $length" $testfile >$tmp.$off &
98
99         # Other tests...
100         #$XFS_IO_PROG -r -c "pread -v -b $bufsize $offset $length" $testfile
101         #sleep 5
102
103         let off=$off+$len # skip over 1
104         let off=$off+$len
105 done
106
107 wait
108 cat $tmp.* | _filter_io
109
110 # success, all done
111 status=0
112 exit