xfs: Check for extent overflow when trivally adding a new extent
[xfstests-dev.git] / tests / xfs / 217
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 217
6 #
7 # large log size mkfs test - ensure the log size scaling works
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20     cd /
21     rm -f $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 # real QA test starts here
29 _supported_fs xfs
30
31 _require_scratch
32 _scratch_mkfs_xfs >/dev/null 2>&1
33 _scratch_mount
34 # 16T mkfs requires a bit over 2G free
35 _require_fs_space $SCRATCH_MNT 2202000
36
37 _require_loop
38 LOOP_DEV=$SCRATCH_MNT/test_fs
39 LOOP_MNT=$SCRATCH_MNT/test_fs_dir
40
41 _do_mkfs()
42 {
43         for i in $*; do
44                 echo -n "fssize=${i}g "
45                 $MKFS_XFS_PROG -f -b size=4096 -l version=2 \
46                         -d name=$LOOP_DEV,size=${i}g |grep log
47                 mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
48                 echo "test write" > $LOOP_MNT/test
49                 umount $LOOP_MNT > /dev/null 2>&1
50
51                 # punch out the previous blocks so that we keep the amount of
52                 # disk space the test requires down to a minimum.
53                 $XFS_IO_PROG -f -c "unresvsp 0 16383g" $LOOP_DEV
54         done
55 }
56 # make large holey file
57 $XFS_IO_PROG -f -c "truncate 16383g" $LOOP_DEV
58
59 #make loopback mount dir
60 mkdir $LOOP_MNT
61
62 # test if large logs are supported
63 $MKFS_XFS_PROG -f -l size=256m -d name=$LOOP_DEV,size=10g > /dev/null 2>&1
64 if [ $? -ne 0 ]; then
65         _notrun "large log sizes not supported by mkfs"
66 fi
67
68 #
69 # walk over "new" sizes supported by recent xfsprogs.
70 # Note that the last test is for 16TB-1GB as 32bit platforms only support
71 # device slightly smaller than 16TB.
72 #
73 _do_mkfs 512 1024 2048 4096 8192 16383
74
75 status=0
76 exit