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 _begin_fstest auto enospc growfs
21 # keep running until failed after growfs
23 [ -f $tmp.growfs ] && in_growfs=true
24 while echo -n >$dir/testfile_$i; do
32 # Import common functions.
35 # real QA test starts here
40 # need 128M space, don't make any assumption
41 _scratch_mkfs >/dev/null 2>&1
43 _require_fs_space $SCRATCH_MNT 131072
46 _scratch_mkfs_sized $((32 * 1024 * 1024)) > $tmp.mkfs.raw
47 cat $tmp.mkfs.raw | _filter_mkfs >$seqres.full 2>$tmp.mkfs
48 # get original data blocks number and agcount
52 nr_worker=$((agcount * 2))
53 echo "Fork $nr_worker workers to consume free inodes in background" >>$seqres.full
56 while [ $i -lt $nr_worker ]; do
57 mkdir $SCRATCH_MNT/testdir_$i
58 create_file $SCRATCH_MNT/testdir_$i &
64 # Grow fs at the same time, at least x4
65 # doubling or tripling the size couldn't reproduce
66 echo "Grow fs to $((dblocks * 4)) blocks" >>$seqres.full
67 $XFS_GROWFS_PROG -D $((dblocks * 4)) $SCRATCH_MNT >>$seqres.full
69 # mark xfs_growfs finished to create_file
72 # Wait for background create_file to hit ENOSPC
75 # log inode status in $seqres.full for debug purpose
76 echo "Inode status after growing fs" >>$seqres.full
77 $DF_PROG -i $SCRATCH_MNT >>$seqres.full
79 # inode should be at least 99% used
80 total_inode=`_get_total_inode $SCRATCH_MNT`
81 used_inode=`_get_used_inode $SCRATCH_MNT`
82 _within_tolerance "used inodes" $used_inode $total_inode %1 -v