d5f89408d14bb02aa60f86abc9109e6f6693feaf
[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 echo "QA output created by $seq"
33
34 here=`pwd`
35 tmp=/tmp/$$
36 status=1        # failure is the default!
37 trap "_cleanup; exit \$status" 0 1 2 3 15
38
39 _cleanup()
40 {
41     cd /
42     rm -f $tmp.*
43 }
44
45 # get standard environment, filters and checks
46 . ./common.rc
47 . ./common.filter
48
49 _supported_fs generic
50 _supported_os Linux
51
52 _require_sparse_files
53 _require_aiodio aiodio_sparse2
54
55 echo "Silence is golden."
56
57 # real QA test starts here
58 rm -f $seq.full
59
60 rm -f $TEST_DIR/aiodio_sparse
61
62 logical_block_size=`blockdev --getss $TEST_DEV`
63 fs_block_size=`stat -f $TEST_DIR | grep "Block size:" | awk '{print $3}'`
64
65 if [ $fs_block_size -le $logical_block_size ]; then
66         _notrun "fs block size must be larger than the device block size.  fs block size: $fs_block_size, device block size: $logical_block_size"
67 fi
68
69 # 2 threads, fs block sized writes, 64k filesize, stride through file by
70 # fs block size, start at logical block size offset
71 $AIO_TEST -i 2 -w $fs_block_size -s 64k -n $fs_block_size -o $logical_block_size "$TEST_DIR/aiodio_sparse"
72
73 status=$?
74 exit