2 # FS QA Test No. xfs/015
4 # Make sure inodes can be allocated in new space added by xfs_growfs
7 # xfs: allow inode allocations in post-growfs disk space
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2014 Red Hat Inc. All Rights Reserved.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
33 status=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
48 # keep running until failed after growfs
50 [ -f $tmp.growfs ] && in_growfs=true
51 while echo -n >$dir/testfile_$i; do
59 # get standard environment, filters and checks
63 # real QA test starts here
69 # need 64M space, don't make any assumption
70 _scratch_mkfs >/dev/null 2>&1
72 _require_fs_space $SCRATCH_MNT 65536
77 _scratch_mkfs_sized $((16 * 1024 * 1024)) | _filter_mkfs >$seqres.full 2>$tmp.mkfs
78 # get original data blocks number and agcount
82 nr_worker=$((agcount * 2))
83 echo "Fork $nr_worker workers to consume free inodes in background" >>$seqres.full
86 while [ $i -lt $nr_worker ]; do
87 mkdir $SCRATCH_MNT/testdir_$i
88 create_file $SCRATCH_MNT/testdir_$i &
94 # Grow fs at the same time, at least x4
95 # doubling or tripling the size couldn't reproduce
96 echo "Grow fs to $((dblocks * 4)) blocks" >>$seqres.full
97 $XFS_GROWFS_PROG -D $((dblocks * 4)) $SCRATCH_MNT >>$seqres.full
99 # mark xfs_growfs finished to create_file
102 # Wait for background create_file to hit ENOSPC
105 # log inode status in $seqres.full for debug purpose
106 echo "Inode status after growing fs" >>$seqres.full
107 $DF_PROG -i $SCRATCH_MNT >>$seqres.full
109 # inode should be at least 99% used
110 total_inode=`_get_total_inode $SCRATCH_MNT`
111 used_inode=`_get_used_inode $SCRATCH_MNT`
112 _within_tolerance "used inodes" $used_inode $total_inode %1 -v