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 128M space, don't make any assumption
70 _scratch_mkfs >/dev/null 2>&1
72 _require_fs_space $SCRATCH_MNT 131072
77 _scratch_mkfs_sized $((32 * 1024 * 1024)) > $tmp.mkfs.raw
78 cat $tmp.mkfs.raw | _filter_mkfs >$seqres.full 2>$tmp.mkfs
79 # get original data blocks number and agcount
83 nr_worker=$((agcount * 2))
84 echo "Fork $nr_worker workers to consume free inodes in background" >>$seqres.full
87 while [ $i -lt $nr_worker ]; do
88 mkdir $SCRATCH_MNT/testdir_$i
89 create_file $SCRATCH_MNT/testdir_$i &
95 # Grow fs at the same time, at least x4
96 # doubling or tripling the size couldn't reproduce
97 echo "Grow fs to $((dblocks * 4)) blocks" >>$seqres.full
98 $XFS_GROWFS_PROG -D $((dblocks * 4)) $SCRATCH_MNT >>$seqres.full
100 # mark xfs_growfs finished to create_file
103 # Wait for background create_file to hit ENOSPC
106 # log inode status in $seqres.full for debug purpose
107 echo "Inode status after growing fs" >>$seqres.full
108 $DF_PROG -i $SCRATCH_MNT >>$seqres.full
110 # inode should be at least 99% used
111 total_inode=`_get_total_inode $SCRATCH_MNT`
112 used_inode=`_get_used_inode $SCRATCH_MNT`
113 _within_tolerance "used inodes" $used_inode $total_inode %1 -v