xfs/530: skip test if user MKFS_OPTIONS screw up formatting
[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 . ./common/preamble
10 _begin_fstest log metadata auto
11
12 # Import common functions.
13 . ./common/filter
14
15 # real QA test starts here
16 _supported_fs xfs
17
18 _require_scratch
19 _scratch_mkfs_xfs >/dev/null 2>&1
20 _scratch_mount
21 # 16T mkfs requires a bit over 2G free
22 _require_fs_space $SCRATCH_MNT 2202000
23
24 _require_loop
25 LOOP_DEV=$SCRATCH_MNT/test_fs
26 LOOP_MNT=$SCRATCH_MNT/test_fs_dir
27
28 _do_mkfs()
29 {
30         for i in $*; do
31                 echo -n "fssize=${i}g "
32                 $MKFS_XFS_PROG -f -b size=4096 -l version=2 \
33                         -d name=$LOOP_DEV,size=${i}g |grep log
34                 mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
35                 echo "test write" > $LOOP_MNT/test
36                 umount $LOOP_MNT > /dev/null 2>&1
37
38                 # punch out the previous blocks so that we keep the amount of
39                 # disk space the test requires down to a minimum.
40                 $XFS_IO_PROG -f -c "unresvsp 0 16383g" $LOOP_DEV
41         done
42 }
43 # make large holey file
44 $XFS_IO_PROG -f -c "truncate 16383g" $LOOP_DEV
45
46 #make loopback mount dir
47 mkdir $LOOP_MNT
48
49 # test if large logs are supported
50 $MKFS_XFS_PROG -f -l size=256m -d name=$LOOP_DEV,size=10g > /dev/null 2>&1
51 if [ $? -ne 0 ]; then
52         _notrun "large log sizes not supported by mkfs"
53 fi
54
55 #
56 # walk over "new" sizes supported by recent xfsprogs.
57 # Note that the last test is for 16TB-1GB as 32bit platforms only support
58 # device slightly smaller than 16TB.
59 #
60 _do_mkfs 512 1024 2048 4096 8192 16383
61
62 status=0
63 exit