xfs: Check for extent overflow when trivally adding a new extent
[xfstests-dev.git] / tests / xfs / 090
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 090
6 #
7 # Exercise IO on the realtime device (direct, buffered, mmapd)
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
17
18 # get standard environment, filters and checks
19 . ./common/rc
20 . ./common/filter
21
22 # real QA test starts here
23 _supported_fs xfs
24 _require_realtime
25 _require_scratch
26
27 _filter_io()
28 {
29         sed -e '/.* ops; /d'
30 }
31
32 _create_scratch()
33 {
34         echo "*** mkfs"
35         if ! _scratch_mkfs_xfs >$tmp.out 2>&1
36         then
37                 cat $tmp.out
38                 echo "failed to mkfs $SCRATCH_DEV"
39                 exit 1
40         fi
41
42         echo "*** mount"
43         if ! _try_scratch_mount
44         then
45                 echo "failed to mount $SCRATCH_DEV"
46                 exit 1
47         fi
48 }
49
50 realtime_direct_aligned()
51 {
52         echo direct realtime writes, 4 files, 2m each, increasing offsets.
53         for i in 0 1 2 3
54         do
55                 $XFS_IO_PROG -fdxR $SCRATCH_MNT/rt-direct-$1-$i \
56                         -c "extsize $1" -c "pwrite ${i}m 1m" \
57                         | _filter_io
58         done
59         _check_scratch_fs
60 }
61
62 realtime_buffer_aligned()
63 {
64         echo buffered realtime writes, 4 files, 2m each, increasing offsets.
65         for i in 0 1 2 3
66         do
67                 $XFS_IO_PROG -fxR $SCRATCH_MNT/rt-buffera-$1-$i \
68                         -c "extsize $1" -c "pwrite ${i}m 1m" \
69                         | _filter_io
70         done
71         _check_scratch_fs
72 }
73
74 realtime_buffer_unaligned()
75 {
76         echo buffered realtime writes, 4 files, unaligned byte offsets/sizes.
77         for i in 0 1 2 3
78         do
79                 $XFS_IO_PROG -fxR $SCRATCH_MNT/rt-bufferu-$1-$i \
80                         -c "extsize $1" -c "pwrite $i 1" \
81                         | _filter_io
82         done
83         _check_scratch_fs
84 }
85
86 realtime_mmap_unaligned()
87 {
88         # mmap realtime writes, 4 files, unaligned byte offsets/sizes.
89         for i in 0 1 2 3
90         do
91                 $XFS_IO_PROG -fxR $SCRATCH_MNT/rt-mmap-$1-$i \
92                         -c "extsize $1" -c "pwrite $i 1" \
93                         | _filter_io
94         done
95         _check_scratch_fs
96 }
97
98 _create_scratch
99
100 realtime_direct_aligned 0
101 #realtime_direct_aligned 1m
102 realtime_buffer_aligned 0
103 #realtime_buffer_aligned 1m
104 realtime_buffer_unaligned 0
105 #realtime_buffer_unaligned 1m
106 #realtime_mmap_unaligned 0
107 #realtime_mmap_unaligned 1m
108
109 status=0
110 exit