xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / btrfs / 204
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle. All Rights Reserved.
4 #
5 # FS QA Test 204
6 #
7 # Test if the unaligned (by size and offset) punch hole is successful when FS
8 # is at ENOSPC.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 # remove previous $seqres.full before test
30 rm -f $seqres.full
31
32 # real QA test starts here
33
34 # Modify as appropriate.
35 _supported_fs btrfs
36 _supported_os Linux
37 _require_scratch
38 _require_xfs_io_command "fpunch"
39
40 _scratch_mkfs_sized $((256 * 1024 *1024)) >> $seqres.full
41
42 # max_inline ensures data is not inlined within metadata extents
43 _scratch_mount "-o max_inline=0,nodatacow"
44
45 cat /proc/self/mounts | grep $SCRATCH_DEV >> $seqres.full
46 $BTRFS_UTIL_PROG filesystem df $SCRATCH_MNT >> $seqres.full
47
48 extent_size=$(_scratch_btrfs_sectorsize)
49 unalign_by=512
50 echo extent_size=$extent_size unalign_by=$unalign_by >> $seqres.full
51
52 $XFS_IO_PROG -f -c "pwrite -S 0xab 0 $((extent_size * 10))" \
53                                         $SCRATCH_MNT/testfile >> $seqres.full
54
55 echo "Fill all space available for data and all unallocated space." >> $seqres.full
56 dd status=none if=/dev/zero of=$SCRATCH_MNT/filler bs=512 >> $seqres.full 2>&1
57
58 hole_offset=0
59 hole_len=$unalign_by
60 $XFS_IO_PROG -c "fpunch $hole_offset $hole_len" $SCRATCH_MNT/testfile
61
62 hole_offset=$(($extent_size + $unalign_by))
63 hole_len=$(($extent_size - $unalign_by))
64 $XFS_IO_PROG -c "fpunch $hole_offset $hole_len" $SCRATCH_MNT/testfile
65
66 hole_offset=$(($extent_size * 2 + $unalign_by))
67 hole_len=$(($extent_size * 5))
68 $XFS_IO_PROG -c "fpunch $hole_offset $hole_len" $SCRATCH_MNT/testfile
69
70 # success, all done
71 echo "Silence is golden"
72 status=0
73 exit