Skip to contentSkip to conversation

xfs: new case to test inode allocations in post-growfs disk space

PATCH Superseded Eryu Guan 4 participants 9 messages Jul 16, 2014 – Jul 31, 2014

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH 1/2 xfs: new case to test inode allocations in post-growfs disk space

Make sure inodes can be allocated in new space added by xfs_growfs.

Regression test for
xfs: allow inode allocations in post-growfs disk space

Cc Eric Sandeen <[email protected]>
Cc Boris Ranto <[email protected]>
---
 common/rc         | 11 +++++++
 tests/xfs/015     | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/015.out |  2 ++
 tests/xfs/group   |  1 +
 4 files changed, 113 insertions(+)
 create mode 100755 tests/xfs/015
 create mode 100644 tests/xfs/015.out
common/rc +11 -0
index 2c83340..255dd9b 100644
@@ -2225,6 +2225,17 @@ _require_btrfs_fs_feature()
 		_notrun "Feature $feat not supported by the available btrfs version"
 }
 
+_get_free_inode()
+{
+	if [ -z "$1" ]; then
+		echo "Usage: _get_free_inode <mnt>"
+		exit 1
+	fi
+	local nr_inode;
+	nr_inode=`$DF_PROG -i $1 | tail -1 | awk '{print $5}'`
+	echo $nr_inode
+}
+
 init_rc()
 {
 	if [ "$iam" == new ]
tests/xfs/015 new file +99 -0

99 lines not on this page · raw message

tests/xfs/015.out new file +2 -0
new file mode 100644
index 0000000..fee0fcf
@@ -0,0 +1,2 @@
+QA output created by 015
+Silence is golden
tests/xfs/group +1 -0
index d5b50b7..0aab336 100644
@@ -12,6 +12,7 @@
 012 rw auto quick
 013 auto metadata stress
 014 auto enospc quick quota
+015 auto enospc growfs
 016 rw auto quick
 017 mount auto quick stress
 018 deprecated # log logprint v2log
Signature · 1 line
1.9.3
#1 lore raw
Quoted 104 lines · Eryu Guan

Make sure inodes can be allocated in new space added by xfs_growfs.

Regression test for
xfs: allow inode allocations in post-growfs disk space

Cc Eric Sandeen <[email protected]>
Cc Boris Ranto <[email protected]>
---
 common/rc         | 11 +++++++
 tests/xfs/015     | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/015.out |  2 ++
 tests/xfs/group   |  1 +
 4 files changed, 113 insertions(+)
 create mode 100755 tests/xfs/015
 create mode 100644 tests/xfs/015.out
common/rc +11 -0
index 2c83340..255dd9b 100644
@@ -2225,6 +2225,17 @@ _require_btrfs_fs_feature()
 		_notrun "Feature $feat not supported by the available btrfs version"
 }
 
+_get_free_inode()
+{
+	if [ -z "$1" ]; then
+		echo "Usage: _get_free_inode <mnt>"
+		exit 1
+	fi
+	local nr_inode;
+	nr_inode=`$DF_PROG -i $1 | tail -1 | awk '{print $5}'`
+	echo $nr_inode
+}
+
 init_rc()
 {
 	if [ "$iam" == new ]
tests/xfs/015 new file +59 -0
new file mode 100755
index 0000000..3db2e0b
@@ -0,0 +1,99 @@
+#! /bin/bash
+# FS QA Test No. xfs/015
+#
+# Make sure inodes can be allocated in new space added by xfs_growfs
+#
+# Regression test for
+# xfs: allow inode allocations in post-growfs disk space
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 Red Hat Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+    rm -f $tmp.*
+}
+
+create_file()
+{
+	local dir=$1
+	local i=0
+
+	while echo -n >$dir/testfile_$i; do
+		let i=$i+1
+	done
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+

tests/xfs/015 line 69

Quoted 10 lines
tests/xfs/015 new file +10 -0
+_require_scratch
+
+rm -f $seqres.full
+echo "Silence is golden"
+
+_scratch_mkfs_sized $((128 * 1024 * 1024)) | _filter_mkfs >$seqres.full 2>$tmp.mkfs
+# get original data blocks number
+. $tmp.mkfs
+_scratch_mount
+

You could probably even make this smaller and make the test quicker. E.g., I can create an fs down to 20M or so without any problems. Also, setting imaxpct=0 might be a good idea so you don't hit that artificial limit.

Quoted 4 lines
tests/xfs/015 new file +4 -0
+# Create files to consume free inodes in background
+(
+	i=0
+	while [ $i -lt 1000 ]; do

tests/xfs/015 line 83

Quoted 10 lines
tests/xfs/015 new file +10 -0
+		mkdir $SCRATCH_MNT/testdir_$i
+		create_file $SCRATCH_MNT/testdir_$i &
+		let i=$i+1
+	done
+) >/dev/null 2>&1 &
+
+# Grow fs at the same time, at least x4
+# doubling or tripling the size couldn't reproduce
+$XFS_GROWFS_PROG -D $((dblocks * 4)) $SCRATCH_MNT >>$seqres.full
+

Even though this is still relatively small based on what people probably typically test, we're still making assumptions about the size of the scratch device. It may be better to create the fs as a file on TEST_DEV. Then you could do something like truncate to a fixed starting size, mkfs at ~20MB and just growfs to the full size of the file. A 4x grow at that point is then still only ~80MB, though hopefully it still doesn't run too long on slower machines.

Quoted 4 lines
tests/xfs/015 new file +4 -0
+# Wait for background create_file to hit ENOSPC
+wait
+
+# log inode status in $seqres.full for debug purpose

tests/xfs/015 line 97

Quoted 10 lines
tests/xfs/015 new file +10 -0
+echo "Inode status after growing fs" >>$seqres.full
+$DF_PROG -i $SCRATCH_MNT >>$seqres.full
+
+# Check free inode count, we expect all free inodes are taken
+free_inode=`_get_free_inode $SCRATCH_MNT`
+if [ $free_inode -gt 0 ]; then
+	echo "$free_inode free inodes available, newly added space not being used"
+else
+	status=0
+fi

This might not be the best metric either. I believe the free inodes count that 'df -Ti' returns is a somewhat artificial calculation based on the number of free blocks available, since we can do dynamic inode allocation. It doesn't necessarily mean that all blocks can be allocated to inodes however (e.g., due to alignment or extent length constraints), so it might never actually read 0 unless the filesystem is perfectly full.

Perhaps consider something like the IUse percentage over a certain threshold?

Brian

Quoted 29 lines
tests/xfs/015 new file +2 -0
+
+exit
tests/xfs/015.out new file +2 -0
new file mode 100644
index 0000000..fee0fcf
@@ -0,0 +1,2 @@
+QA output created by 015
+Silence is golden
tests/xfs/group +1 -0
index d5b50b7..0aab336 100644
@@ -12,6 +12,7 @@
 012 rw auto quick
 013 auto metadata stress
 014 auto enospc quick quota
+015 auto enospc growfs
 016 rw auto quick
 017 mount auto quick stress
 018 deprecated # log logprint v2log
Signature · 6 lines
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 5 lines · Brian Foster
Quoted 4 lines · Eryu Guan

Make sure inodes can be allocated in new space added by xfs_growfs.

Regression test for
xfs: allow inode allocations in post-growfs disk space

....

Quoted 10 lines
Quoted 10 lines
tests/xfs/015 new file +10 -0
+# Create files to consume free inodes in background
+(
+	i=0
+	while [ $i -lt 1000 ]; do
+		mkdir $SCRATCH_MNT/testdir_$i
+		create_file $SCRATCH_MNT/testdir_$i &
+		let i=$i+1
+	done
+) >/dev/null 2>&1 &
+
Quoted 8 lines

tests/xfs/015 line 83

Quoted 4 lines
tests/xfs/015 new file +4 -0
+# Grow fs at the same time, at least x4
+# doubling or tripling the size couldn't reproduce
+$XFS_GROWFS_PROG -D $((dblocks * 4)) $SCRATCH_MNT >>$seqres.full
+

Even though this is still relatively small based on what people probably typically test, we're still making assumptions about the size of the scratch device.

_require_fs_space $SCRATCH_MNT <size>

solves that problem. And in places we require 10GB of space, so a few hundred MB isn't an issue.

-Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#3 lore raw
In reply to Brian Foster
Quoted 1 line · Brian Foster

On Thu, Jul 17, 2014 at 12:52:33AM +0800, Eryu Guan wrote:

[snip]

Quoted 21 lines
Quoted 21 lines
tests/xfs/015 new file +21 -0
+
+create_file()
+{
+	local dir=$1
+	local i=0
+
+	while echo -n >$dir/testfile_$i; do
+		let i=$i+1
+	done
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+
+_require_scratch
+
Quoted 9 lines

tests/xfs/015 line 69

Quoted 8 lines
tests/xfs/015 new file +8 -0
+rm -f $seqres.full
+echo "Silence is golden"
+
+_scratch_mkfs_sized $((128 * 1024 * 1024)) | _filter_mkfs >$seqres.full 2>$tmp.mkfs
+# get original data blocks number
+. $tmp.mkfs
+_scratch_mount
+

Hi Brian,

Thanks for the review, and sorry for the late response..

Quoted 4 lines

You could probably even make this smaller and make the test quicker. E.g., I can create an fs down to 20M or so without any problems. Also, setting imaxpct=0 might be a good idea so you don't hit that artificial limit.

Yes, a smaller fs could make the test much more quicker. I tested with 16M fs and the test time reduced from 70s to ~10s on my test host.

But setting imaxpct=0 could increase the total available inode number which could make test run longer. So I tend to use default mkfs options here.

Quoted 16 lines
Quoted 5 lines
tests/xfs/015 new file +4 -0
+# Create files to consume free inodes in background
+(
+	i=0
+	while [ $i -lt 1000 ]; do

tests/xfs/015 line 83

Quoted 10 lines
tests/xfs/015 new file +10 -0
+		mkdir $SCRATCH_MNT/testdir_$i
+		create_file $SCRATCH_MNT/testdir_$i &
+		let i=$i+1
+	done
+) >/dev/null 2>&1 &
+
+# Grow fs at the same time, at least x4
+# doubling or tripling the size couldn't reproduce
+$XFS_GROWFS_PROG -D $((dblocks * 4)) $SCRATCH_MNT >>$seqres.full
+
Quoted 7 lines

Even though this is still relatively small based on what people probably typically test, we're still making assumptions about the size of the scratch device. It may be better to create the fs as a file on TEST_DEV. Then you could do something like truncate to a fixed starting size, mkfs at ~20MB and just growfs to the full size of the file. A 4x grow at that point is then still only ~80MB, though hopefully it still doesn't run too long on slower machines.

I'll use _require_fs_space here as Dave suggested.

Quoted 24 lines
Quoted 5 lines
tests/xfs/015 new file +4 -0
+# Wait for background create_file to hit ENOSPC
+wait
+
+# log inode status in $seqres.full for debug purpose

tests/xfs/015 line 97

Quoted 10 lines
tests/xfs/015 new file +10 -0
+echo "Inode status after growing fs" >>$seqres.full
+$DF_PROG -i $SCRATCH_MNT >>$seqres.full
+
+# Check free inode count, we expect all free inodes are taken
+free_inode=`_get_free_inode $SCRATCH_MNT`
+if [ $free_inode -gt 0 ]; then
+	echo "$free_inode free inodes available, newly added space not being used"
+else
+	status=0
+fi

This might not be the best metric either. I believe the free inodes count that 'df -Ti' returns is a somewhat artificial calculation based on the number of free blocks available, since we can do dynamic inode allocation. It doesn't necessarily mean that all blocks can be allocated to inodes however (e.g., due to alignment or extent length constraints), so it might never actually read 0 unless the filesystem is perfectly full.

Quoted 2 lines

Perhaps consider something like the IUse percentage over a certain threshold?

I'm not sure about the proper percentage here, I'll try %99. But in my test on RHEL6 the free inode count is always 0 after test.

Will send out v2 soon.

Thanks,
Eryu

Quoted 37 lines

Brian

Quoted 29 lines
(quoted diff) +2 -0
+
+exit
tests/xfs/015.out new file +2 -0
new file mode 100644
index 0000000..fee0fcf
@@ -0,0 +1,2 @@
+QA output created by 015
+Silence is golden
tests/xfs/group +1 -0
index d5b50b7..0aab336 100644
@@ -12,6 +12,7 @@
 012 rw auto quick
 013 auto metadata stress
 014 auto enospc quick quota
+015 auto enospc growfs
 016 rw auto quick
 017 mount auto quick stress
 018 deprecated # log logprint v2log
Signature · 6 lines
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#4 lore raw
Quoted 38 lines · Eryu Guan
Quoted 1 line · Brian Foster

On Thu, Jul 17, 2014 at 12:52:33AM +0800, Eryu Guan wrote:

[snip]

Quoted 21 lines
Quoted 21 lines
tests/xfs/015 new file +21 -0
+
+create_file()
+{
+	local dir=$1
+	local i=0
+
+	while echo -n >$dir/testfile_$i; do
+		let i=$i+1
+	done
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+
+_require_scratch
+
Quoted 9 lines

tests/xfs/015 line 69

Quoted 8 lines
tests/xfs/015 new file +8 -0
+rm -f $seqres.full
+echo "Silence is golden"
+
+_scratch_mkfs_sized $((128 * 1024 * 1024)) | _filter_mkfs >$seqres.full 2>$tmp.mkfs
+# get original data blocks number
+. $tmp.mkfs
+_scratch_mount
+

Hi Brian,

Thanks for the review, and sorry for the late response..

Quoted 8 lines
Quoted 4 lines

You could probably even make this smaller and make the test quicker. E.g., I can create an fs down to 20M or so without any problems. Also, setting imaxpct=0 might be a good idea so you don't hit that artificial limit.

Yes, a smaller fs could make the test much more quicker. I tested with 16M fs and the test time reduced from 70s to ~10s on my test host.

That sounds great.

Quoted 4 lines

But setting imaxpct=0 could increase the total available inode number which could make test run longer. So I tend to use default mkfs options here.

True... I don't really want to make a big deal out of imaxpct. I think the consensus now is that it's a useless relic and will probably be removed. That does mean this test will eventually use the full fs space by default and we should make sure it runs in a reasonable amount of time. FWIW, it seems to in my tests, running in under 2 minutes on a single spindle.

The other issue is that if I set imaxpct=1 in my mkfs options, the test passes. Should it? Is it actually testing what it should be in that scenario? ;) Note that when imaxpct is set, the 'df -i' information will be based on the cap that imaxpct sets. E.g., it will show 100% usage even though we've only used a few MB for inodes.

Brian

Quoted 102 lines
Quoted 16 lines
Quoted 5 lines
tests/xfs/015 new file +4 -0
+# Create files to consume free inodes in background
+(
+	i=0
+	while [ $i -lt 1000 ]; do

tests/xfs/015 line 83

Quoted 10 lines
tests/xfs/015 new file +10 -0
+		mkdir $SCRATCH_MNT/testdir_$i
+		create_file $SCRATCH_MNT/testdir_$i &
+		let i=$i+1
+	done
+) >/dev/null 2>&1 &
+
+# Grow fs at the same time, at least x4
+# doubling or tripling the size couldn't reproduce
+$XFS_GROWFS_PROG -D $((dblocks * 4)) $SCRATCH_MNT >>$seqres.full
+
Quoted 7 lines

Even though this is still relatively small based on what people probably typically test, we're still making assumptions about the size of the scratch device. It may be better to create the fs as a file on TEST_DEV. Then you could do something like truncate to a fixed starting size, mkfs at ~20MB and just growfs to the full size of the file. A 4x grow at that point is then still only ~80MB, though hopefully it still doesn't run too long on slower machines.

I'll use _require_fs_space here as Dave suggested.

Quoted 24 lines
Quoted 5 lines
tests/xfs/015 new file +4 -0
+# Wait for background create_file to hit ENOSPC
+wait
+
+# log inode status in $seqres.full for debug purpose

tests/xfs/015 line 97

Quoted 10 lines
tests/xfs/015 new file +10 -0
+echo "Inode status after growing fs" >>$seqres.full
+$DF_PROG -i $SCRATCH_MNT >>$seqres.full
+
+# Check free inode count, we expect all free inodes are taken
+free_inode=`_get_free_inode $SCRATCH_MNT`
+if [ $free_inode -gt 0 ]; then
+	echo "$free_inode free inodes available, newly added space not being used"
+else
+	status=0
+fi

This might not be the best metric either. I believe the free inodes count that 'df -Ti' returns is a somewhat artificial calculation based on the number of free blocks available, since we can do dynamic inode allocation. It doesn't necessarily mean that all blocks can be allocated to inodes however (e.g., due to alignment or extent length constraints), so it might never actually read 0 unless the filesystem is perfectly full.

Quoted 2 lines

Perhaps consider something like the IUse percentage over a certain threshold?

I'm not sure about the proper percentage here, I'll try %99. But in my test on RHEL6 the free inode count is always 0 after test.

Will send out v2 soon.

Thanks,
Eryu

Quoted 28 lines

Brian

Quoted 25 lines
(quoted diff) +2 -0
+
+exit
tests/xfs/015.out new file +2 -0
new file mode 100644
index 0000000..fee0fcf
@@ -0,0 +1,2 @@
+QA output created by 015
+Silence is golden
tests/xfs/group +1 -0
index d5b50b7..0aab336 100644
@@ -12,6 +12,7 @@
 012 rw auto quick
 013 auto metadata stress
 014 auto enospc quick quota
+015 auto enospc growfs
 016 rw auto quick
 017 mount auto quick stress
 018 deprecated # log logprint v2log
Signature · 1 line
1.9.3
Quoted 9 lines
Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#5 lore raw
Quoted 62 lines · Brian Foster
Quoted 38 lines · Eryu Guan
Quoted 1 line · Brian Foster

On Thu, Jul 17, 2014 at 12:52:33AM +0800, Eryu Guan wrote:

[snip]

Quoted 21 lines
Quoted 21 lines
tests/xfs/015 new file +21 -0
+
+create_file()
+{
+	local dir=$1
+	local i=0
+
+	while echo -n >$dir/testfile_$i; do
+		let i=$i+1
+	done
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+
+_require_scratch
+
Quoted 9 lines

tests/xfs/015 line 69

Quoted 8 lines
tests/xfs/015 new file +8 -0
+rm -f $seqres.full
+echo "Silence is golden"
+
+_scratch_mkfs_sized $((128 * 1024 * 1024)) | _filter_mkfs >$seqres.full 2>$tmp.mkfs
+# get original data blocks number
+. $tmp.mkfs
+_scratch_mount
+

Hi Brian,

Thanks for the review, and sorry for the late response..

Quoted 8 lines
Quoted 4 lines

You could probably even make this smaller and make the test quicker. E.g., I can create an fs down to 20M or so without any problems. Also, setting imaxpct=0 might be a good idea so you don't hit that artificial limit.

Yes, a smaller fs could make the test much more quicker. I tested with 16M fs and the test time reduced from 70s to ~10s on my test host.

That sounds great.

Quoted 4 lines

But setting imaxpct=0 could increase the total available inode number which could make test run longer. So I tend to use default mkfs options here.

True... I don't really want to make a big deal out of imaxpct. I think the consensus now is that it's a useless relic and will probably be removed. That does mean this test will eventually use the full fs space by default and we should make sure it runs in a reasonable amount of time. FWIW, it seems to in my tests, running in under 2 minutes on a single spindle.

Quoted 5 lines

The other issue is that if I set imaxpct=1 in my mkfs options, the test passes. Should it? Is it actually testing what it should be in that scenario? ;) Note that when imaxpct is set, the 'df -i' information will be based on the cap that imaxpct sets. E.g., it will show 100% usage even though we've only used a few MB for inodes.

Yes, I can pass the test too with imaxpct=1 set. But I'm not really sure about imaxpct impact on the test result.

Eric, do you have any suggestions here? Because I saw you send out the kernel patch to fix this problem :)

Thanks,
Eryu

Quoted 109 lines

Brian

Quoted 98 lines
Quoted 16 lines
Quoted 5 lines
tests/xfs/015 new file +4 -0
+# Create files to consume free inodes in background
+(
+	i=0
+	while [ $i -lt 1000 ]; do

tests/xfs/015 line 83

Quoted 10 lines
tests/xfs/015 new file +10 -0
+		mkdir $SCRATCH_MNT/testdir_$i
+		create_file $SCRATCH_MNT/testdir_$i &
+		let i=$i+1
+	done
+) >/dev/null 2>&1 &
+
+# Grow fs at the same time, at least x4
+# doubling or tripling the size couldn't reproduce
+$XFS_GROWFS_PROG -D $((dblocks * 4)) $SCRATCH_MNT >>$seqres.full
+
Quoted 7 lines

Even though this is still relatively small based on what people probably typically test, we're still making assumptions about the size of the scratch device. It may be better to create the fs as a file on TEST_DEV. Then you could do something like truncate to a fixed starting size, mkfs at ~20MB and just growfs to the full size of the file. A 4x grow at that point is then still only ~80MB, though hopefully it still doesn't run too long on slower machines.

I'll use _require_fs_space here as Dave suggested.

Quoted 24 lines
Quoted 5 lines
tests/xfs/015 new file +4 -0
+# Wait for background create_file to hit ENOSPC
+wait
+
+# log inode status in $seqres.full for debug purpose

tests/xfs/015 line 97

Quoted 10 lines
tests/xfs/015 new file +10 -0
+echo "Inode status after growing fs" >>$seqres.full
+$DF_PROG -i $SCRATCH_MNT >>$seqres.full
+
+# Check free inode count, we expect all free inodes are taken
+free_inode=`_get_free_inode $SCRATCH_MNT`
+if [ $free_inode -gt 0 ]; then
+	echo "$free_inode free inodes available, newly added space not being used"
+else
+	status=0
+fi

This might not be the best metric either. I believe the free inodes count that 'df -Ti' returns is a somewhat artificial calculation based on the number of free blocks available, since we can do dynamic inode allocation. It doesn't necessarily mean that all blocks can be allocated to inodes however (e.g., due to alignment or extent length constraints), so it might never actually read 0 unless the filesystem is perfectly full.

Quoted 2 lines

Perhaps consider something like the IUse percentage over a certain threshold?

I'm not sure about the proper percentage here, I'll try %99. But in my test on RHEL6 the free inode count is always 0 after test.

Will send out v2 soon.

Thanks,
Eryu

Quoted 28 lines

Brian

Quoted 25 lines
(quoted diff) +2 -0
+
+exit
tests/xfs/015.out new file +2 -0
new file mode 100644
index 0000000..fee0fcf
@@ -0,0 +1,2 @@
+QA output created by 015
+Silence is golden
tests/xfs/group +1 -0
index d5b50b7..0aab336 100644
@@ -12,6 +12,7 @@
 012 rw auto quick
 013 auto metadata stress
 014 auto enospc quick quota
+015 auto enospc growfs
 016 rw auto quick
 017 mount auto quick stress
 018 deprecated # log logprint v2log
Signature · 1 line
1.9.3
Quoted 9 lines
Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
Quoted 69 lines · Eryu Guan
Quoted 62 lines · Brian Foster
Quoted 38 lines · Eryu Guan
Quoted 1 line · Brian Foster

On Thu, Jul 17, 2014 at 12:52:33AM +0800, Eryu Guan wrote:

[snip]

Quoted 21 lines
Quoted 21 lines
tests/xfs/015 new file +21 -0
+
+create_file()
+{
+	local dir=$1
+	local i=0
+
+	while echo -n >$dir/testfile_$i; do
+		let i=$i+1
+	done
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+
+_require_scratch
+
Quoted 9 lines

tests/xfs/015 line 69

Quoted 8 lines
tests/xfs/015 new file +8 -0
+rm -f $seqres.full
+echo "Silence is golden"
+
+_scratch_mkfs_sized $((128 * 1024 * 1024)) | _filter_mkfs >$seqres.full 2>$tmp.mkfs
+# get original data blocks number
+. $tmp.mkfs
+_scratch_mount
+

Hi Brian,

Thanks for the review, and sorry for the late response..

Quoted 8 lines
Quoted 4 lines

You could probably even make this smaller and make the test quicker. E.g., I can create an fs down to 20M or so without any problems. Also, setting imaxpct=0 might be a good idea so you don't hit that artificial limit.

Yes, a smaller fs could make the test much more quicker. I tested with 16M fs and the test time reduced from 70s to ~10s on my test host.

That sounds great.

Quoted 4 lines

But setting imaxpct=0 could increase the total available inode number which could make test run longer. So I tend to use default mkfs options here.

True... I don't really want to make a big deal out of imaxpct. I think the consensus now is that it's a useless relic and will probably be removed. That does mean this test will eventually use the full fs space by default and we should make sure it runs in a reasonable amount of time. FWIW, it seems to in my tests, running in under 2 minutes on a single spindle.

Quoted 5 lines

The other issue is that if I set imaxpct=1 in my mkfs options, the test passes. Should it? Is it actually testing what it should be in that scenario? ;) Note that when imaxpct is set, the 'df -i' information will be based on the cap that imaxpct sets. E.g., it will show 100% usage even though we've only used a few MB for inodes.

Quoted 6 lines

Yes, I can pass the test too with imaxpct=1 set. But I'm not really sure about imaxpct impact on the test result.

Eric, do you have any suggestions here? Because I saw you send out the kernel patch to fix this problem :)

(I think Eric might be away.)

To be clear, I'm just suggesting we verify whether the test is as focused as possible. Put another way, have we verified whether this test detects the problem with this potential configuration? E.g., run a kernel without Eric's growfs fix, run the test and verify it fails. Repeat with '-i imaxpct=1' in MKFS_OPTIONS and verify the test still fails. If it does, then it's probably fine. If it passes, that's a hole in the test case we should close up.

Brian

Quoted 115 lines

Thanks,
Eryu

Quoted 101 lines

Brian

Quoted 98 lines
Quoted 16 lines
Quoted 5 lines
tests/xfs/015 new file +4 -0
+# Create files to consume free inodes in background
+(
+	i=0
+	while [ $i -lt 1000 ]; do

tests/xfs/015 line 83

Quoted 10 lines
tests/xfs/015 new file +10 -0
+		mkdir $SCRATCH_MNT/testdir_$i
+		create_file $SCRATCH_MNT/testdir_$i &
+		let i=$i+1
+	done
+) >/dev/null 2>&1 &
+
+# Grow fs at the same time, at least x4
+# doubling or tripling the size couldn't reproduce
+$XFS_GROWFS_PROG -D $((dblocks * 4)) $SCRATCH_MNT >>$seqres.full
+
Quoted 7 lines

Even though this is still relatively small based on what people probably typically test, we're still making assumptions about the size of the scratch device. It may be better to create the fs as a file on TEST_DEV. Then you could do something like truncate to a fixed starting size, mkfs at ~20MB and just growfs to the full size of the file. A 4x grow at that point is then still only ~80MB, though hopefully it still doesn't run too long on slower machines.

I'll use _require_fs_space here as Dave suggested.

Quoted 24 lines
Quoted 5 lines
tests/xfs/015 new file +4 -0
+# Wait for background create_file to hit ENOSPC
+wait
+
+# log inode status in $seqres.full for debug purpose

tests/xfs/015 line 97

Quoted 10 lines
tests/xfs/015 new file +10 -0
+echo "Inode status after growing fs" >>$seqres.full
+$DF_PROG -i $SCRATCH_MNT >>$seqres.full
+
+# Check free inode count, we expect all free inodes are taken
+free_inode=`_get_free_inode $SCRATCH_MNT`
+if [ $free_inode -gt 0 ]; then
+	echo "$free_inode free inodes available, newly added space not being used"
+else
+	status=0
+fi

This might not be the best metric either. I believe the free inodes count that 'df -Ti' returns is a somewhat artificial calculation based on the number of free blocks available, since we can do dynamic inode allocation. It doesn't necessarily mean that all blocks can be allocated to inodes however (e.g., due to alignment or extent length constraints), so it might never actually read 0 unless the filesystem is perfectly full.

Quoted 2 lines

Perhaps consider something like the IUse percentage over a certain threshold?

I'm not sure about the proper percentage here, I'll try %99. But in my test on RHEL6 the free inode count is always 0 after test.

Will send out v2 soon.

Thanks,
Eryu

Quoted 37 lines

Brian

Quoted 29 lines
(quoted diff) +2 -0
+
+exit
tests/xfs/015.out new file +2 -0
new file mode 100644
index 0000000..fee0fcf
@@ -0,0 +1,2 @@
+QA output created by 015
+Silence is golden
tests/xfs/group +1 -0
index d5b50b7..0aab336 100644
@@ -12,6 +12,7 @@
 012 rw auto quick
 013 auto metadata stress
 014 auto enospc quick quota
+015 auto enospc growfs
 016 rw auto quick
 017 mount auto quick stress
 018 deprecated # log logprint v2log
Signature · 6 lines
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Quoted 8 lines
Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#7 lore raw
Quoted 5 lines · Brian Foster
Quoted 4 lines · Eryu Guan
Quoted 3 lines · Brian Foster
Quoted 2 lines · Eryu Guan
Quoted 1 line · Brian Foster

On Thu, Jul 17, 2014 at 12:52:33AM +0800, Eryu Guan wrote:

[snip]

Quoted 50 lines
Quoted 33 lines
Quoted 27 lines
Quoted 4 lines

Hi Brian,

Thanks for the review, and sorry for the late response..

Quoted 8 lines
Quoted 4 lines

You could probably even make this smaller and make the test quicker. E.g., I can create an fs down to 20M or so without any problems. Also, setting imaxpct=0 might be a good idea so you don't hit that artificial limit.

Yes, a smaller fs could make the test much more quicker. I tested with 16M fs and the test time reduced from 70s to ~10s on my test host.

That sounds great.

Quoted 4 lines

But setting imaxpct=0 could increase the total available inode number which could make test run longer. So I tend to use default mkfs options here.

True... I don't really want to make a big deal out of imaxpct. I think the consensus now is that it's a useless relic and will probably be removed. That does mean this test will eventually use the full fs space by default and we should make sure it runs in a reasonable amount of time. FWIW, it seems to in my tests, running in under 2 minutes on a single spindle.

Quoted 5 lines

The other issue is that if I set imaxpct=1 in my mkfs options, the test passes. Should it? Is it actually testing what it should be in that scenario? ;) Note that when imaxpct is set, the 'df -i' information will be based on the cap that imaxpct sets. E.g., it will show 100% usage even though we've only used a few MB for inodes.

Quoted 6 lines

Yes, I can pass the test too with imaxpct=1 set. But I'm not really sure about imaxpct impact on the test result.

Eric, do you have any suggestions here? Because I saw you send out the kernel patch to fix this problem :)

(I think Eric might be away.)

To be clear, I'm just suggesting we verify whether the test is as focused as possible. Put another way, have we verified whether this test detects the problem with this potential configuration? E.g., run a kernel without Eric's growfs fix, run the test and verify it fails. Repeat with '-i imaxpct=1' in MKFS_OPTIONS and verify the test still fails. If it does, then it's probably fine. If it passes, that's a hole in the test case we should close up.

Quoted 1 line

Brian

Thanks Brian, I'll look into it and try to work it out.

(Note that with my v2 patch, the maxpct number in question is 5 instead of 1)

Thanks,
Eryu

author
#8 lore raw

PATCH v2 1/1 xfs: new case to test inode allocations in post-growfs disk space

In reply to Eryu Guan

Make sure inodes can be allocated in new space added by xfs_growfs.

Regression test for
xfs: allow inode allocations in post-growfs disk space

---
v2:
- test on 16M xfs to make test quicker, ~70s -> ~10s
- use _require_fs_space to check $SCRATCH_MNT space
- reduce inode consumer count to agcount * 2, not hardcoded 1000
- expect 99% inode usage, not absolute number 0 of free inode
- new _get_total_inode and _get_used_inode helper, and keep _get_free_inode helper which could benefit other tests

 common/rc         |  33 +++++++++++++++++
 tests/xfs/015     | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/015.out |   2 ++
 tests/xfs/group   |   1 +
 4 files changed, 141 insertions(+)
 create mode 100755 tests/xfs/015
 create mode 100644 tests/xfs/015.out
common/rc +33 -0
index 2c83340..407fb94 100644
@@ -2225,6 +2225,39 @@ _require_btrfs_fs_feature()
 		_notrun "Feature $feat not supported by the available btrfs version"
 }
 
+_get_total_inode()
+{
+	if [ -z "$1" ]; then
+		echo "Usage: _get_total_inode <mnt>"
+		exit 1
+	fi
+	local nr_inode;
+	nr_inode=`$DF_PROG -i $1 | tail -1 | awk '{print $3}'`
+	echo $nr_inode
+}
+
+_get_used_inode()
+{
+	if [ -z "$1" ]; then
+		echo "Usage: _get_used_inode <mnt>"
+		exit 1
+	fi
+	local nr_inode;
+	nr_inode=`$DF_PROG -i $1 | tail -1 | awk '{print $4}'`
+	echo $nr_inode
+}
+
+_get_free_inode()
+{
+	if [ -z "$1" ]; then
+		echo "Usage: _get_free_inode <mnt>"
+		exit 1
+	fi
+	local nr_inode;
+	nr_inode=`$DF_PROG -i $1 | tail -1 | awk '{print $5}'`
+	echo $nr_inode
+}
+
 init_rc()
 {
 	if [ "$iam" == new ]
tests/xfs/015 new file +105 -0

105 lines not on this page · raw message

tests/xfs/015.out new file +2 -0
new file mode 100644
index 0000000..8275ab3
@@ -0,0 +1,2 @@
+QA output created by 015
+used inodes is in range
tests/xfs/group +1 -0
index d5b50b7..0aab336 100644
@@ -12,6 +12,7 @@
 012 rw auto quick
 013 auto metadata stress
 014 auto enospc quick quota
+015 auto enospc growfs
 016 rw auto quick
 017 mount auto quick stress
 018 deprecated # log logprint v2log
Signature · 1 line
1.8.3.1