xfstests/xfs: test inode allocation with fragmented free space
PATCH v2 1/1 xfstests/xfs: test inode allocation with fragmented free space
XFS dynamic inode allocation has a fundamental limitation in that an inode chunk requires a contiguous extent of a minimum size. Depending on the level of free space fragmentation, inode allocation can fail with ENOSPC where the filesystem might not be near 100% usage.
The sparse inodes feature was implemented to provide an inode allocation strategy that maximizes the ability to allocate inodes under free space fragmentation. This test fragments free space and verifies that filesystems that support sparse inode allocation can allocate a minimum percentage of inodes on the fs.
---
v2:
- Modified test to explicitly format with -i sparse instead of passive detection.
- Create and use generic _require_xfs_sparse_inodes().
- Refactored various utility functions into generic helpers.
- Cleaned up some commands and error checking cruft.
- Cleaned up and added more detailed comments.
- Based golden output on _within_tolerance() filter.
v1: http://article.gmane.org/gmane.comp.file-systems.fstests/830
common/rc | 37 ++++++++++++++++ tests/xfs/075 | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/075.out | 2 + tests/xfs/group | 1 + 4 files changed, 170 insertions(+) create mode 100755 tests/xfs/075 create mode 100644 tests/xfs/075.out
common/rc +37 -0
@@ -1449,6 +1449,18 @@ _require_xfs_sysfs() fi } +# this test requires the xfs sparse inode feature +# +_require_xfs_sparse_inodes() +{ + _scratch_mkfs_xfs_supported -m crc=1 -i sparse > /dev/null 2>&1 \ + || _notrun "mkfs.xfs does not support sparse inodes" + _scratch_mkfs_xfs -m crc=1 -i sparse > /dev/null 2>&1 + _scratch_mount >/dev/null 2>&1 \ + || _notrun "kernel does not support sparse inodes" + umount $SCRATCH_MNT +} + # this test requires that external log/realtime devices are not in use # _require_nonexternal()
@@ -2724,6 +2736,18 @@ _get_used_inode() echo $nr_inode } +_get_used_inode_percent() +{ + if [ -z "$1" ]; then + echo "Usage: _get_used_inode_percent <mnt>" + exit 1 + fi + local pct_inode; + pct_inode=`$DF_PROG -i $1 | tail -1 | awk '{ print $6 }' | \ + sed -e 's/%//'` + echo $pct_inode +} + _get_free_inode() { if [ -z "$1" ]; then
@@ -2735,6 +2759,19 @@ _get_free_inode() echo $nr_inode } +# get the available space in bytes +# +_get_available_space() +{ + if [ -z "$1" ]; then + echo "Usage: _get_available_space <mnt>" + exit 1 + fi + local avail_kb; + avail_kb=`$DF_PROG $1 | tail -n1 | awk '{ print $5 }'` + echo $((avail_kb * 1024)) +} + # get btrfs profile configs being tested # # A set of pre-set profile configs are exported via _btrfs_profile_configs
tests/xfs/075 new file +130 -0
130 lines not on this page · raw message
tests/xfs/075.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 075 +iusepct is in range
tests/xfs/group +1 -0
@@ -71,6 +71,7 @@ 071 rw auto 072 rw auto prealloc quick 073 copy auto +075 auto enospc 078 growfs auto quick 080 rw ioctl 081 deprecated # log logprint quota
Signature · 1 line
1.9.3