fsx/fsstress: round blocksize properly
[xfstests-dev.git] / tests / generic / 240
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2010 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 240
6 #
7 # Test that non-block-aligned aio+dio into holes does not leave
8 # zero'd out portions of the file
9 #
10 # QEMU IO to a file-backed device with misaligned partitions
11 # can send this sort of IO
12 #
13 # This test need only be run in the case where the logical block size
14 # of the device can be smaller than the file system block size.
15 #
16 seq=`basename $0`
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
19
20 here=`pwd`
21 tmp=/tmp/$$
22 status=1        # failure is the default!
23 trap "_cleanup; exit \$status" 0 1 2 3 15
24
25 _cleanup()
26 {
27     cd /
28     rm -f $tmp.*
29 }
30
31 # get standard environment, filters and checks
32 . ./common/rc
33 . ./common/filter
34
35 _supported_fs generic
36
37 _require_test
38 _require_sparse_files
39 _require_aiodio aiodio_sparse2
40
41 echo "Silence is golden."
42
43 # real QA test starts here
44 rm -f $seqres.full
45
46 rm -f $TEST_DIR/aiodio_sparse
47
48 logical_block_size=`_min_dio_alignment $TEST_DEV`
49 fs_block_size=`_get_block_size $TEST_DIR`
50 file_size=$((8 * $fs_block_size))
51
52 if [ $fs_block_size -le $logical_block_size ]; then
53         _notrun "fs block size must be larger than the device block size.  fs block size: $fs_block_size, device block size: $logical_block_size"
54 fi
55
56 # 2 threads, fs block sized writes, filesize, stride through file by
57 # fs block size, start at logical block size offset
58 $AIO_TEST -i 2 -w $fs_block_size -s $file_size -n $fs_block_size -o $logical_block_size "$TEST_DIR/aiodio_sparse"
59
60 status=$?
61 exit