e32f15ae3435966fc40d32960a720f92cfb56fc1
[xfstests-dev.git] / tests / generic / 240
1 #! /bin/bash
2 # FS QA Test No. 240
3 #
4 # Test that non-block-aligned aio+dio into holes does not leave
5 # zero'd out portions of the file
6 #
7 # QEMU IO to a file-backed device with misaligned partitions
8 # can send this sort of IO
9 #
10 # This test need only be run in the case where the logical block size
11 # of the device can be smaller than the file system block size.
12 #
13 #-----------------------------------------------------------------------
14 # Copyright (c) 2010 Red Hat, Inc.  All Rights Reserved.
15 #
16 # This program is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License as
18 # published by the Free Software Foundation.
19 #
20 # This program is distributed in the hope that it would be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 # GNU General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write the Free Software Foundation,
27 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
28 #-----------------------------------------------------------------------
29 #
30
31 seq=`basename $0`
32 seqres=$RESULT_DIR/$seq
33 echo "QA output created by $seq"
34
35 here=`pwd`
36 tmp=/tmp/$$
37 status=1        # failure is the default!
38 trap "_cleanup; exit \$status" 0 1 2 3 15
39
40 _cleanup()
41 {
42     cd /
43     rm -f $tmp.*
44 }
45
46 # get standard environment, filters and checks
47 . ./common/rc
48 . ./common/filter
49
50 _supported_fs generic
51 _supported_os Linux
52
53 _require_test
54 _require_sparse_files
55 _require_aiodio aiodio_sparse2
56
57 echo "Silence is golden."
58
59 # real QA test starts here
60 rm -f $seqres.full
61
62 rm -f $TEST_DIR/aiodio_sparse
63
64 logical_block_size=`_min_dio_alignment $TEST_DEV`
65 fs_block_size=`get_block_size $TEST_DIR`
66 file_size=$((8 * $fs_block_size))
67
68 if [ $fs_block_size -le $logical_block_size ]; then
69         _notrun "fs block size must be larger than the device block size.  fs block size: $fs_block_size, device block size: $logical_block_size"
70 fi
71
72 # 2 threads, fs block sized writes, filesize, stride through file by
73 # fs block size, start at logical block size offset
74 $AIO_TEST -i 2 -w $fs_block_size -s $file_size -n $fs_block_size -o $logical_block_size "$TEST_DIR/aiodio_sparse"
75
76 status=$?
77 exit