xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / generic / 092
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Facebook.  All Rights Reserved.
4 #
5 # FS QA Test No. 092
6 #
7 # fallocate/truncate tests with FALLOC_FL_KEEP_SIZE option.
8 # Verify if the disk space is released after truncating a file to i_size after
9 # writing to a portion of a preallocated range.
10 #
11 # This also verifies that truncat'ing up past i_size doesn't remove the
12 # preallocated space.
13 #
14 seq=`basename $0`
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
17
18 here=`pwd`
19 tmp=/tmp/$$
20 status=0        # success is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
22
23 _cleanup()
24 {
25         cd /
26         rm -f $tmp.*
27 }
28
29 # get standard environment, filters and checks
30 . ./common/rc
31 . ./common/filter
32 . ./common/punch
33
34 # real QA test starts here
35
36 # Modify as appropriate.
37 _supported_fs generic
38 _supported_os Linux
39 _require_test
40 _require_xfs_io_command "falloc"
41 _require_xfs_io_command "fiemap"
42
43 # First test to make sure that truncating at i_size trims the preallocated bit
44 # past i_size
45 $XFS_IO_PROG -f -c "falloc -k 0 10M" -c "pwrite 0 5M" -c "truncate 5M"\
46         $TEST_DIR/testfile.$seq | _filter_xfs_io
47 sync
48 $XFS_IO_PROG -c "fiemap -v" $TEST_DIR/testfile.$seq | _filter_fiemap
49
50 # Now verify that if we truncate up past i_size we don't trim the preallocated
51 # bit
52 $XFS_IO_PROG -c "falloc -k 5M 5M" -c "truncate 7M" $TEST_DIR/testfile.$seq
53 $XFS_IO_PROG -c "fiemap -v" $TEST_DIR/testfile.$seq | _filter_fiemap
54
55 # success, all done
56 exit