tests: remove udf/101
[xfstests-dev.git] / tests / generic / 416
1 #! /bin/bash
2 # FS QA Test 416
3 #
4 # Test fs behavior when large write request can't be met by one single extent
5 #
6 # Inspired by a bug in a btrfs fix, which doesn't get exposed by current test
7 # cases
8 #
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2017 Fujitsu.  All Rights Reserved.
11 #
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
15 #
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24 #-----------------------------------------------------------------------
25 #
26
27 seq=`basename $0`
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
30
31 here=`pwd`
32 tmp=/tmp/$$
33 status=1        # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
35
36 _cleanup()
37 {
38         cd /
39         rm -f $tmp.*
40 }
41
42 # get standard environment, filters and checks
43 . ./common/rc
44 . ./common/filter
45
46 # remove previous $seqres.full before test
47 rm -f $seqres.full
48
49 # real QA test starts here
50
51 # Modify as appropriate.
52 _supported_fs generic
53 _supported_os IRIX Linux
54 _require_scratch
55
56 fs_size=$((128 * 1024 * 1024))
57 page_size=$(get_page_size)
58
59 # We will never reach this number though
60 nr_files=$(($fs_size / $page_size))
61
62 # Use small fs to make the fill more faster
63 _scratch_mkfs_sized $fs_size >> $seqres.full 2>&1
64
65 _scratch_mount
66
67 fill_fs()
68 {
69         dir=$1
70         for i in $(seq -w $nr_files); do
71                 # xfs_io can't return correct value when it hit ENOSPC, use
72                 # dd here to detect ENOSPC
73                 dd if=/dev/zero of=$SCRATCH_MNT/$i bs=$page_size count=1 \
74                         &> /dev/null
75                 if [ $? -ne 0 ]; then
76                         break
77                 fi
78         done
79 }
80
81 fill_fs $SCRATCH_MNT
82
83 # remount to sync every thing into fs, and drop all cache
84 _scratch_remount
85
86 # remove all files with odd file names, which should free near half
87 # of the space
88 rm $SCRATCH_MNT/*[13579]
89 sync
90
91 # We should be able to write at least 1/8 of the whole fs size
92 # The number 1/8 is for btrfs, which only has about 47M for data.
93 # And half of the 47M is already taken up, so only 1/8 is safe here
94 $XFS_IO_PROG -f -c "pwrite 0 $(($fs_size / 8))" $SCRATCH_MNT/large_file | \
95         _filter_xfs_io
96
97 # success, all done
98 status=0
99 exit