generic/233,270: unlimit the max locked memory size for io_uring
[xfstests-dev.git] / tests / xfs / 206
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2009 Eric Sandeen.
4 #
5 # FS QA Test No. 206
6 #
7 # Test trim of last small AG for large filesystem resizes
8 #
9 # As reported at
10 # http://article.gmane.org/gmane.comp.file-systems.xfs.general/29187
11 # this trimming may cause an overflow in the new size calculation.
12 # Patch and testcase at
13 # http://article.gmane.org/gmane.comp.file-systems.xfs.general/29193
14 #
15 seq=`basename $0`
16 seqres=$RESULT_DIR/$seq
17 echo "QA output created by $seq"
18
19 here=`pwd`
20 tmp=/tmp/$$
21 status=1        # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
23
24 _cleanup()
25 {
26     umount $tmpdir
27     rmdir $tmpdir
28     rm -f $tmp
29     rm -f $tmpfile
30 }
31
32 # get standard environment, filters and checks
33 . ./common/rc
34 . ./common/filter
35
36 # real QA test starts here
37
38 # Modify as appropriate.
39 _supported_fs xfs
40 _require_test
41 _require_loop
42
43 bitsperlong=`$here/src/feature -w`
44 if [ "$bitsperlong" -ne 64 ]; then
45         _notrun "This test is only valid on 64 bit machines"
46 fi
47
48 rm -f $seqres.full
49
50 tmpfile=$TEST_DIR/fsfile.$$
51 tmpdir=$TEST_DIR/tmpdir.$$
52
53 mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir"
54
55 # Create a file w/ the offset we wish to resize to
56 echo "=== truncate file ==="
57 dd if=/dev/zero of=$tmpfile bs=1 seek=19998630180864 count=1 >/dev/null 2>&1 \
58         || _fail "!!! failed to truncate loopback file to correct size"
59
60 # mkfs/growfs output has changed slightly over the years, this distills
61 # it down to a common set of output parameters we care about
62 mkfs_filter()
63 {
64         sed -e 's/meta-data=[^ ]*/meta-data=FILE/' \
65             -e 's/ *isize=[0-9]* / isize=N /' \
66             -e "s/\(^log.*blocks=\)\([0-9]*,\)/\1XXXXX,/" \
67             -e "s/internal log/internal    /" \
68             -e "s/, projid32bit=[0-9]//" \
69             -e "s/,\? ftype=[0-9]//" \
70             -e "/.*reflink=/d" \
71             -e "s/\(sectsz\)\(=[0-9]* *\)/\1=512   /" \
72             -e "s/\(sunit=\)\([0-9]* blks,\)/\10 blks,/" \
73             -e "s/, lazy-count=[0-9]//" \
74             -e "/.*crc=/d" \
75             -e "/^Default configuration/d"
76 }
77
78 # mkfs slightly smaller than that, small log for speed.
79 echo "=== mkfs.xfs ==="
80 mkfs.xfs -f -bsize=4096 -l size=32m -dagsize=76288719b,size=3905982455b \
81          $tmpfile  | mkfs_filter
82
83 mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount"
84
85 # see what happens when we growfs it
86 echo "=== xfs_growfs ==="
87 xfs_growfs $tmpdir  | mkfs_filter
88
89 # and double-check the new geometry
90 echo "=== xfs_info ==="
91 $XFS_INFO_PROG $tmpdir | mkfs_filter
92
93 # _cleanup cleans up for us
94
95 # success, all done
96 status=0
97 exit
98