generic/233,270: unlimit the max locked memory size for io_uring
[xfstests-dev.git] / tests / xfs / 259
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2011 Red Hat.  All Rights Reserved.
4 #
5 # FS QA Test No. 259
6 #
7 # Test fs creation on 4 TB minus few bytes partition
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 status=1        # failure is the default!
14
15 _cleanup()
16 {
17     rm -f "$testfile"
18 }
19
20 trap "_cleanup ; exit \$status" 0 1 2 3 15
21
22 # get standard environment, filters and checks
23 . ./common/rc
24 . ./common/filter
25
26 # real QA test starts here
27 _supported_fs xfs
28 _require_test
29 _require_loop
30 _require_math
31
32 testfile=$TEST_DIR/259.image
33
34 # Test various sizes slightly less than 4 TB. Need to handle different
35 # minimum block sizes for CRC enabled filesystems, but use a small log so we
36 # don't write lots of zeros unnecessarily.
37 sizes_to_check="4096 2048 1024 512"
38 blocksizes="4096 2048 1024 512"
39 four_TB=$(_math "2^42")
40 # The initial value of _fs_has_crcs is not important, because we start testing
41 # with 4096 block size, it only matters for 512 block size test
42 _fs_has_crcs=0
43 for del in $sizes_to_check; do
44         for bs in $blocksizes; do
45                 echo "Trying to make (4TB - ${del}B) long xfs, block size $bs"
46                 # skip tests with 512 block size if the fs created has crc
47                 # enabled by default
48                 if [ $_fs_has_crcs -eq 1 -a $bs -eq 512 ]; then
49                         break;
50                 fi
51                 ddseek=$(_math "$four_TB - $del")
52                 rm -f "$testfile"
53                 dd if=/dev/zero "of=$testfile" bs=1 count=0 seek=$ddseek \
54                         >/dev/null 2>&1 || echo "dd failed"
55                 lofile=$(losetup -f)
56                 losetup $lofile "$testfile"
57                 $MKFS_XFS_PROG -l size=32m -b size=$bs $lofile |  _filter_mkfs \
58                         >/dev/null 2> $tmp.mkfs || echo "mkfs failed!"
59                 . $tmp.mkfs
60                 sync
61                 losetup -d $lofile
62         done
63 done
64
65 status=0
66 exit