xfs/007: fix regressions on V4 filesystems
[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 . ./common/preamble
13 _begin_fstest rw pattern auto prealloc quick
14
15 _filter_io()
16 {
17     tee -a $seqres.full | _filter_xfs_io
18 }
19
20 #
21 # <    1: [8..79]:         6552..6623        0 (6552..6623)        72
22 # >    1: [8..79]:         202544..202615    0 (202544..202615)    72
23 #
24 _filter_bmap()
25 {
26     awk '$3 ~ /hole/ { print $1, $2, $3; next }
27          {print $1, $2}' >> $seqres.full
28 }
29
30 # Import common functions.
31 . ./common/filter
32
33 # real QA test starts here
34
35 # Modify as appropriate.
36 _supported_fs xfs
37 _require_test
38 _require_xfs_io_command "falloc"
39
40 # io tests 
41 testfile=$TEST_DIR/file.$seq
42 rm -f $testfile
43 len=4
44 end=`expr 10 \* $len`
45
46 # Other test...
47 #$XFS_IO_PROG -f -c "resvsp ${off}k ${end}k" $testfile
48
49 # write the initial file
50 $XFS_IO_PROG -f -c "pwrite 0  ${end}k" $testfile | _filter_io
51
52 off=0
53 while [ $off -le $end ]
54 do
55         offset=${off}k
56         length=${len}k
57
58         $XFS_IO_PROG -c "unresvsp $offset $length" -c "bmap -vp" $testfile | _filter_bmap
59
60         let off=$off+$len # skip over 1
61         let off=$off+$len
62 done
63
64 off=0
65 while [ $off -le $end ]
66 do
67         offset=${off}k
68         length=${len}k
69         bufsize=${len}k
70         echo ""
71         echo "*** offset = $offset ***"
72         echo ""
73
74         # prealloc and write
75         $XFS_IO_PROG -d -c "resvsp $offset $length" -c "pwrite -b $bufsize $offset $length" $testfile | _filter_io
76
77         # Other tests...
78         #$XFS_IO_PROG -c "resvsp $offset $length" $testfile
79         #xfs_bmap -v -p $testfile
80         #$XFS_IO_PROG -d -c "pwrite -b $bufsize $offset $length" $testfile
81         #xfs_bmap -v -p $testfile
82
83         $XFS_IO_PROG -r -c "pread -v -b $bufsize $offset $length" $testfile >$tmp.$off &
84
85         # Other tests...
86         #$XFS_IO_PROG -r -c "pread -v -b $bufsize $offset $length" $testfile
87         #sleep 5
88
89         let off=$off+$len # skip over 1
90         let off=$off+$len
91 done
92
93 wait
94 cat $tmp.* | _filter_io
95
96 # success, all done
97 status=0
98 exit