4 # Test fs behavior when large write request can't be met by one single extent
6 # Inspired by a bug in a btrfs fix, which doesn't get exposed by current test
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2017 Fujitsu. All Rights Reserved.
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.
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.
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 #-----------------------------------------------------------------------
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
33 status=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
42 # get standard environment, filters and checks
46 # remove previous $seqres.full before test
49 # real QA test starts here
51 # Modify as appropriate.
53 _supported_os IRIX Linux
56 fs_size=$((128 * 1024 * 1024))
57 page_size=$(get_page_size)
59 # We will never reach this number though
60 nr_files=$(($fs_size / $page_size))
62 # Use small fs to make the fill more faster
63 _scratch_mkfs_sized $fs_size >> $seqres.full 2>&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 \
83 # remount to sync every thing into fs, and drop all cache
86 # remove all files with odd file names, which should free near half
88 rm $SCRATCH_MNT/*[13579]
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 | \