2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Red Hat Inc. All Rights Reserved.
5 # FS QA Test No. xfs/015
7 # Make sure inodes can be allocated in new space added by xfs_growfs
10 # xfs: allow inode allocations in post-growfs disk space
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
33 # keep running until failed after growfs
35 [ -f $tmp.growfs ] && in_growfs=true
36 while echo -n >$dir/testfile_$i; do
44 # get standard environment, filters and checks
48 # real QA test starts here
54 # need 128M space, don't make any assumption
55 _scratch_mkfs >/dev/null 2>&1
57 _require_fs_space $SCRATCH_MNT 131072
62 _scratch_mkfs_sized $((32 * 1024 * 1024)) > $tmp.mkfs.raw
63 cat $tmp.mkfs.raw | _filter_mkfs >$seqres.full 2>$tmp.mkfs
64 # get original data blocks number and agcount
68 nr_worker=$((agcount * 2))
69 echo "Fork $nr_worker workers to consume free inodes in background" >>$seqres.full
72 while [ $i -lt $nr_worker ]; do
73 mkdir $SCRATCH_MNT/testdir_$i
74 create_file $SCRATCH_MNT/testdir_$i &
80 # Grow fs at the same time, at least x4
81 # doubling or tripling the size couldn't reproduce
82 echo "Grow fs to $((dblocks * 4)) blocks" >>$seqres.full
83 $XFS_GROWFS_PROG -D $((dblocks * 4)) $SCRATCH_MNT >>$seqres.full
85 # mark xfs_growfs finished to create_file
88 # Wait for background create_file to hit ENOSPC
91 # log inode status in $seqres.full for debug purpose
92 echo "Inode status after growing fs" >>$seqres.full
93 $DF_PROG -i $SCRATCH_MNT >>$seqres.full
95 # inode should be at least 99% used
96 total_inode=`_get_total_inode $SCRATCH_MNT`
97 used_inode=`_get_used_inode $SCRATCH_MNT`
98 _within_tolerance "used inodes" $used_inode $total_inode %1 -v