Skip to contentSkip to conversation

xfs: test inode32/inode64 options w/ remount & growfs

PATCH New Eric Sandeen 1 participant 1 message Feb 11, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: test inode32/inode64 options w/ remount & growfs

inode32/inode64 allocator behavior with respect to mount, remount and growfs is a little tricky.

The inode32 mount option should only enable the inode32 allocator heuristics if the filesystem is large enough for 64-bit inodes to exist. Today, it has this behavior on the initial mount, but a remount with inode32 unconditionally changes the allocation heuristics, even for a small fs.

Also, an inode32 mounted small filesystem should transition to the inode32 allocator if the filesystem is subsequently grown to a sufficient size. Today that does not happen.

This test tests both of these behaviors and demonstrates the problem.

---

right now the golden output is the actual AGs for file data allocation; I'm not sure if that's too "tight" an output or not - the rotor *does* have well-defined behavior, so I think it's ok.

tests/xfs/260 new file +135 -0
new file mode 100755
index 0000000..a5e2324
@@ -0,0 +1,135 @@
+#! /bin/bash
+# FS QA Test 260
+#
+# Test inode32/inode64 mount/remount options, with growfs
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 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.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs xfs
+_supported_os Linux
+_require_test
+_require_loop
+
+loopfile=$TEST_DIR/testfile
+loopmnt=$TEST_DIR/mnt
+
+mkdir -p $loopmnt
+
+# Takes file path as argument
+create_and_map()
+{
+	echo foo > $1
+	xfs_bmap -v $1 | grep -v "EXT\|file" | awk '{print $4}'
+}
+
+# Test proper inode32/inode64 behavior for initial mount and remount.
+# mount, remount, remount
+#
+# Args: size, initial opt, first remount, 2nd remount
+# i.e.: 512g inode32 inode64 inode32
+#   or:   4t inode64 inode32 inode64
+workout_remount()
+{
+	echo "Remount: $1, $2, $3, $4"
+
+	rm -f $loopfile
+	xfs_io -f -c "truncate $1" $loopfile
+	$MKFS_XFS_PROG $loopfile >> $seqres.full 2>&1
+
+	echo "mount $2"
+	mount -t xfs -o loop,$2 $loopfile $loopmnt
+	for I in `seq 1 4`; do create_and_map $loopmnt/file$I; done
+
+	echo "remount $3"
+	mount -o remount,$3 $loopmnt
+	for I in `seq 5 8`; do create_and_map $loopmnt/file$I; done
+
+	echo "remount $4"
+	mount -o remount,$4 $loopmnt
+	for I in `seq 9 12`; do create_and_map $loopmnt/file$I; done
+
+	umount $loopmnt
+}
+
+# Test proper inode32/inode64 across a growfs
+# Mount, grow, remount
+#
+# Args: size1, size2, mount opt, remount opt
+# i.e.: 512g 1t inode32 inode64
+
+workout_growfs()
+{
+	echo "Growfs: $1, $2, $3, $4"
+
+	rm -f $loopfile
+	xfs_io -f -c "truncate $2" $loopfile
+	$MKFS_XFS_PROG -d size=$1 $loopfile >> $seqres.full 2>&1
+
+	echo "$1, mount $3"
+	mount -t xfs -o loop,$3 $loopfile $loopmnt
+	for I in `seq 1 4`; do create_and_map $loopmnt/file$I; done
+
+	echo "growfs $1 to $2"
+	$XFS_GROWFS_PROG $loopmnt >> $seqres.full 2>&1
+	for I in `seq 5 12`; do create_and_map $loopmnt/file$I; done
+
+	# Do more than 4 files here to try to hit new AGs
+	echo "$2, remount $4"
+	mount -o remount,$4 $loopmnt
+	for I in `seq 13 20`; do create_and_map $loopmnt/file$I; done
+
+	umount $loopmnt
+}
+
+workout_remount 128g inode64 inode32 inode64
+workout_remount 128g inode32 inode64 inode32
+workout_remount   4t inode64 inode32 inode64
+workout_remount   4t inode32 inode64 inode32
+
+workout_growfs 1t 4t inode32 inode64
+workout_growfs 1t 4t inode64 inode32
+
+# success, all done
+status=0
+exit
tests/xfs/260.out new file +113 -0

113 lines not on this page · raw message

tests/xfs/group +1 -0
index 2db3520..ce0c69d 100644
@@ -207,6 +207,7 @@
 252 auto quick prealloc
 253 auto quick
 259 auto quick
+260 auto growfs
 261 auto quick quota
 262 auto quick quota
 266 dump ioctl auto quick