]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
mkfs: don't hardcode log size
authorDarrick J. Wong <djwong@kernel.org>
Mon, 3 Feb 2025 22:00:29 +0000 (14:00 -0800)
committerZorro Lang <zlang@kernel.org>
Tue, 18 Feb 2025 04:42:39 +0000 (12:42 +0800)
Commit 000813899afb46 hardcoded a log size of 256MB into xfs/501,
xfs/502, and generic/530.  This seems to be an attempt to reduce test
run times by increasing the log size so that more background threads can
run in parallel.  Unfortunately, this breaks a couple of my test
configurations:

 - External logs smaller than 256MB
 - Internal logs where the AG size is less than 256MB

For example, here's seqres.full from a failed xfs/501 invocation:

** mkfs failed with extra mkfs options added to " -m metadir=2,autofsck=1,uquota,gquota,pquota, -d rtinherit=1," by test 501 **
** attempting to mkfs using only test 501 options: -l size=256m **
size 256m specified for log subvolume is too large, maximum is 32768 blocks
<snip>
mount -ortdev=/dev/sdb4 -ologdev=/dev/sdb2 /dev/sda4 /opt failed
umount: /dev/sda4: not mounted.

Note that there's some formatting error here, so we jettison the entire
rt configuration to force the log size option, but then mount fails
because we didn't edit out the rtdev option there too.

Fortunately, mkfs.xfs already /has/ a few options to try to improve
parallelism in the filesystem by avoiding contention on the log grant
heads by scaling up the log size.  These options are aware of log and AG
size constraints so they won't conflict with other geometry options.

Use them.

Cc: <fstests@vger.kernel.org> # v2024.12.08
Fixes: 000813899afb46 ("fstests: scale some tests for high CPU count sanity")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/rc
tests/generic/530
tests/generic/531
tests/xfs/501
tests/xfs/502

index a3d49e861f1f2c8a43c5e235476d26917f25a870..60f5f11984488f13f3b3b1e33a84fe35079858c4 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -688,6 +688,33 @@ _test_cycle_mount()
     _test_mount
 }
 
+# Are there mkfs options to try to improve concurrency?
+_scratch_mkfs_concurrency_options()
+{
+       local nr_cpus=$(getconf _NPROCESSORS_CONF)
+
+       case "$FSTYP" in
+       xfs)
+               # If any concurrency options are already specified, don't
+               # compute our own conflicting ones.
+               echo "$SCRATCH_OPTIONS $MKFS_OPTIONS" | \
+                       grep -q 'concurrency=' &&
+                       return
+
+               local sections=(d r)
+
+               # -l concurrency does not work with external logs
+               test _has_logdev || sections+=(l)
+
+               for section in "${sections[@]}"; do
+                       $MKFS_XFS_PROG -$section concurrency=$nr_cpus 2>&1 | \
+                               grep -q "unknown option -$section" ||
+                               echo "-$section concurrency=$nr_cpus "
+               done
+               ;;
+       esac
+}
+
 _scratch_mkfs_options()
 {
     _scratch_options mkfs
index f2513156a920e8c8514b70f364d19b276784d3c3..b2aab4f354e9f34456fd9f3654c7f355af2cfd03 100755 (executable)
@@ -25,11 +25,7 @@ _require_test_program "t_open_tmpfiles"
 # For XFS, pushing 50000 unlinked inode inactivations through a small xfs log
 # can result in bottlenecks on the log grant heads, so try to make the log
 # larger to reduce runtime.
-if [ "$FSTYP" = "xfs" ] && ! _has_logdev; then
-    _scratch_mkfs "-l size=256m" >> $seqres.full 2>&1
-else
-    _scratch_mkfs >> $seqres.full 2>&1
-fi
+_scratch_mkfs $(_scratch_mkfs_concurrency_options) >> $seqres.full 2>&1
 _scratch_mount
 
 # Set ULIMIT_NOFILE to min(file-max / 2, 50000 files per LOAD_FACTOR)
index ed6c3f91153ecc66fda77207615bcf4df2808e21..07dffd9fd5108dc88c536657270833cec4f396aa 100755 (executable)
@@ -23,11 +23,7 @@ _require_test_program "t_open_tmpfiles"
 
 # On high CPU count machines, this runs a -lot- of create and unlink
 # concurrency. Set the filesytsem up to handle this.
-if [ $FSTYP = "xfs" ]; then
-       _scratch_mkfs "-d agcount=32" >> $seqres.full 2>&1
-else
-       _scratch_mkfs >> $seqres.full 2>&1
-fi
+_scratch_mkfs $(_scratch_mkfs_concurrency_options) >> $seqres.full 2>&1
 _scratch_mount
 
 # Try to load up all the CPUs, two threads per CPU.
index 678c51b52948c57a615c7551e31ada3468b650b1..c62ec443848797bee07a03c450e21e4239e0328c 100755 (executable)
@@ -33,7 +33,7 @@ _require_xfs_sysfs debug/log_recovery_delay
 _require_scratch
 _require_test_program "t_open_tmpfiles"
 
-_scratch_mkfs "-l size=256m" >> $seqres.full 2>&1
+_scratch_mkfs $(_scratch_mkfs_concurrency_options) >> $seqres.full 2>&1
 _scratch_mount
 
 # Set ULIMIT_NOFILE to min(file-max / 2, 30000 files per LOAD_FACTOR)
index 10b0017f6b2eb22c5642c9ac308f672c91da3bdf..ebfb5ce883c3787e00f6b26e2feff1e654200075 100755 (executable)
@@ -23,7 +23,7 @@ _require_xfs_io_error_injection "iunlink_fallback"
 _require_scratch
 _require_test_program "t_open_tmpfiles"
 
-_scratch_mkfs "-l size=256m" | _filter_mkfs 2> $tmp.mkfs > /dev/null
+_scratch_mkfs $(_scratch_mkfs_concurrency_options) | _filter_mkfs 2> $tmp.mkfs > /dev/null
 cat $tmp.mkfs >> $seqres.full
 . $tmp.mkfs