diff mbox series

[2/4] xfs: test inobtcount upgrade

Message ID 159770526657.3960575.11874406628211391398.stgit@magnolia (mailing list archive)
State Superseded
Headers show
Series xfstests: widen timestamps to deal with y2038 | expand

Commit Message

Darrick J. Wong Aug. 17, 2020, 11:01 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Make sure we can actually upgrade filesystems to support inobtcounts.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/xfs        |   16 ++++++++++++++
 tests/xfs/910     |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/910.out |    3 +++
 tests/xfs/group   |    1 +
 4 files changed, 80 insertions(+)
 create mode 100755 tests/xfs/910
 create mode 100644 tests/xfs/910.out
diff mbox series

Patch

diff --git a/common/xfs b/common/xfs
index ce279041..05ed768a 100644
--- a/common/xfs
+++ b/common/xfs
@@ -955,3 +955,19 @@  _xfs_get_cowgc_interval() {
 		_fail "Can't find cowgc interval procfs knob?"
 	fi
 }
+
+_require_xfs_mkfs_inobtcount()
+{
+	_scratch_mkfs_xfs_supported -m inobtcount=1 >/dev/null 2>&1 \
+	   || _notrun "mkfs.xfs doesn't have inobtcount feature"
+}
+
+_require_xfs_scratch_inobtcount()
+{
+	_require_scratch
+
+	_scratch_mkfs -m inobtcount=1 > /dev/null
+	_try_scratch_mount || \
+		_notrun "inobtcount not supported by scratch filesystem type: $FSTYP"
+	_scratch_unmount
+}
diff --git a/tests/xfs/910 b/tests/xfs/910
new file mode 100755
index 00000000..3cc5fca2
--- /dev/null
+++ b/tests/xfs/910
@@ -0,0 +1,60 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2020, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# FS QA Test No. 910
+#
+# Check that we can upgrade a filesystem to support inobtcount and that
+# everything works properly after the upgrade.
+
+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
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+_require_command "$XFS_ADMIN_PROG" "xfs_admin"
+_require_xfs_mkfs_inobtcount
+_require_xfs_scratch_inobtcount
+
+rm -f $seqres.full
+
+# Format V5 filesystem without inode btree counter support and populate it
+_scratch_mkfs -m crc=1,inobtcount=0 > $seqres.full
+_scratch_xfs_db -c 'version' -c 'sb 0' -c 'p' >> $seqres.full
+_scratch_mount >> $seqres.full
+
+echo moo > $SCRATCH_MNT/urk
+
+_scratch_unmount
+_check_scratch_fs
+
+# Now upgrade to inobtcount support
+_scratch_xfs_admin -O inobtcount >> $seqres.full
+_check_scratch_fs
+_scratch_xfs_db -c 'version' -c 'sb 0' -c 'p' -c 'agi 0' -c 'p' >> $seqres.full
+
+# Mount again, look at our files
+_scratch_mount >> $seqres.full
+cat $SCRATCH_MNT/urk
+
+# success, all done
+echo Silence is golden.
+status=0
+exit
diff --git a/tests/xfs/910.out b/tests/xfs/910.out
new file mode 100644
index 00000000..83992f49
--- /dev/null
+++ b/tests/xfs/910.out
@@ -0,0 +1,3 @@ 
+QA output created by 910
+moo
+Silence is golden.
diff --git a/tests/xfs/group b/tests/xfs/group
index 8ecdc5ba..b144d391 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -531,4 +531,5 @@ 
 746 auto quick online_repair
 747 auto quick scrub
 748 auto quick scrub
+910 auto quick inobtcount
 915 auto quick quota