@@ -689,6 +689,33 @@ _test_cycle_mount()
_test_mount
}
+# Are there mkfs options to try to improve concurrency?
+_scratch_mkfs_concurrency_options()
+{
+ local nr_cpus="$(( $1 * LOAD_FACTOR ))"
+
+ 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
@@ -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 32) >> $seqres.full 2>&1
_scratch_mount
# Set ULIMIT_NOFILE to min(file-max / 2, 50000 files per LOAD_FACTOR)
@@ -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 32) >> $seqres.full 2>&1
_scratch_mount
# Try to load up all the CPUs, two threads per CPU.
@@ -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 32) >> $seqres.full 2>&1
_scratch_mount
# Set ULIMIT_NOFILE to min(file-max / 2, 30000 files per LOAD_FACTOR)
@@ -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 32) | _filter_mkfs 2> $tmp.mkfs > /dev/null
cat $tmp.mkfs >> $seqres.full
. $tmp.mkfs