Skip to content

Commit

Permalink
test-appliance: add support to use a mkfs config file for LTS kernels
Browse files Browse the repository at this point in the history
Older LTS kernels don't necessarily support all of the file system
features of modern kernels.  So detect when we are testing an LTS
kernel, and if available, use an file system specific mkfs config file
(if available) to constrain the file system features needed for that
kernel version and file system type.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
tytso committed Dec 18, 2024
1 parent 9a9587d commit 01da22b
Show file tree
Hide file tree
Showing 11 changed files with 220 additions and 0 deletions.
8 changes: 8 additions & 0 deletions run-fstests/util/parse_cli
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ local-ssd
local-ssd-nvme
log
machtype:
mkfs_config:
modules:
monitor-timeout:
nfssrv:
Expand Down Expand Up @@ -540,6 +541,9 @@ while (( $# >= 1 )); do
KERNEL_ARCH="$1"
SKIP_KERNEL_ARCH_PROBE="yes"
;;
--mkfs_config) shift
MKFS_CONFIG="$1"
;;
--modules) shift
supported_flavors kvm gce
case "$1" in
Expand Down Expand Up @@ -1132,6 +1136,10 @@ if test -n "$SOAK_DURATION" ; then
FSTESTOPT="$FSTESTOPT,soak,$SOAK_DURATION"
fi

if test -n "$MKFS_CONFIG" ; then
FSTESTOPT="$FSTESTOPT,mkfs_config,$MKFS_CONFIG"
fi

FSTESTOPT=${FSTESTOPT/#,/}

case "$FSTESTCFG" in
Expand Down
19 changes: 19 additions & 0 deletions test-appliance/files/root/fs/xfs/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#

DEFAULT_MKFS_OPTIONS=""
if test -n "$MKFS_CONFIG_FILE" ; then
DEFAULT_MKFS_OPTIONS="-c options=$MKFS_CONFIG_FILE"
fi

function check_filesystem()
{
Expand All @@ -26,6 +29,21 @@ function check_filesystem()
return "$ret"
}

function xfs_adjust_mkfs_opts()
{
if test -z "$MKFS_CONFIG_FILE" ; then
return
fi
if test -z "$XFS_MKFS_OPTIONS" ; then
XFS_MKFS_OPTIONS="-c options=$MKFS_CONFIG_FILE"
else
XFS_MKFS_OPTIONS="$XFS_MKFS_OPTIONS -c options=$MKFS_CONFIG_FILE"
fi
export XFS_MKFS_OPTIONS
}

adjust_mkfs_options=xfs_adjust_mkfs_opts

function format_filesystem()
{
local dev="$1"
Expand Down Expand Up @@ -85,4 +103,5 @@ function reset_vars()
{
unset XFS_MOUNT_OPTIONS
unset XFS_MKFS_OPTIONS
unset adjust_mkfs_options
}
19 changes: 19 additions & 0 deletions test-appliance/files/root/fs/xfs/mkfs_cfg/lts_4.19.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# V5 features that were the mkfs defaults when the upstream Linux 4.19 LTS
# kernel was released at the end of 2018.

[metadata]
bigtime=0
crc=1
finobt=1
inobtcount=0
reflink=0
rmapbt=0
autofsck=0

[inode]
sparse=1
nrext64=0
exchange=0

[naming]
parent=0
19 changes: 19 additions & 0 deletions test-appliance/files/root/fs/xfs/mkfs_cfg/lts_5.10.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# V5 features that were the mkfs defaults when the upstream Linux 5.10 LTS
# kernel was released at the end of 2020.

[metadata]
bigtime=0
crc=1
finobt=1
inobtcount=0
reflink=1
rmapbt=0
autofsck=0

[inode]
sparse=1
nrext64=0
exchange=0

[naming]
parent=0
19 changes: 19 additions & 0 deletions test-appliance/files/root/fs/xfs/mkfs_cfg/lts_5.15.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# V5 features that were the mkfs defaults when the upstream Linux 5.15 LTS
# kernel was released at the end of 2021.

[metadata]
bigtime=1
crc=1
finobt=1
inobtcount=1
reflink=1
rmapbt=0
autofsck=0

[inode]
sparse=1
nrext64=0
exchange=0

[naming]
parent=0
19 changes: 19 additions & 0 deletions test-appliance/files/root/fs/xfs/mkfs_cfg/lts_5.4.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# V5 features that were the mkfs defaults when the upstream Linux 5.4 LTS
# kernel was released at the end of 2019.

[metadata]
bigtime=0
crc=1
finobt=1
inobtcount=0
reflink=1
rmapbt=0
autofsck=0

[inode]
sparse=1
nrext64=0
exchange=0

[naming]
parent=0
19 changes: 19 additions & 0 deletions test-appliance/files/root/fs/xfs/mkfs_cfg/lts_6.1.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# V5 features that were the mkfs defaults when the upstream Linux 6.1 LTS
# kernel was released at the end of 2022.

[metadata]
bigtime=1
crc=1
finobt=1
inobtcount=1
reflink=1
rmapbt=0
autofsck=0

[inode]
sparse=1
nrext64=0
exchange=0

[naming]
parent=0
19 changes: 19 additions & 0 deletions test-appliance/files/root/fs/xfs/mkfs_cfg/lts_6.12.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# V5 features that were the mkfs defaults when the upstream Linux 6.12 LTS
# kernel was released at the end of 2024.

[metadata]
bigtime=1
crc=1
finobt=1
inobtcount=1
reflink=1
rmapbt=1
autofsck=0

[inode]
sparse=1
nrext64=1
exchange=0

[naming]
parent=0
19 changes: 19 additions & 0 deletions test-appliance/files/root/fs/xfs/mkfs_cfg/lts_6.6.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# V5 features that were the mkfs defaults when the upstream Linux 6.6 LTS
# kernel was released at the end of 2023.

[metadata]
bigtime=1
crc=1
finobt=1
inobtcount=1
reflink=1
rmapbt=1
autofsck=0

[inode]
sparse=1
nrext64=1
exchange=0

[naming]
parent=0
9 changes: 9 additions & 0 deletions test-appliance/files/root/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ while [ "$1" != "" ]; do
no_truncate_test_files)
NO_TRUNCATE=t
;;
mkfs_config) shift
MKFS_CONFIG="$1"
;;
*)
echo " "
echo "Unrecognized option $1"
Expand All @@ -71,6 +74,9 @@ while [ "$1" != "" ]; do
done

gen_version_files
if test -z "$MKFS_CONFIG" ; then
set_mkfs_config
fi
umount "$PRI_TST_DEV" >& /dev/null
umount "$SM_TST_DEV" >& /dev/null
if ! get_fs_config $FSTESTTYP ; then
Expand Down Expand Up @@ -294,6 +300,9 @@ do
echo TEST_LOGDEV: $TEST_LOGDEV >> "$RESULT_BASE/config"
echo SCRATCH_RTDEV: $SCRATCH_RTDEV >> "$RESULT_BASE/config"
echo TEST_RTDEV: $TEST_RTDEV >> "$RESULT_BASE/config"
if test -n "$MKFS_CONFIG_FILE" ; then
echo MKFS_CONFIG: $MKFS_CONFIG >> "$RESULT_BASE/config"
fi
show_mkfs_opts >> "$RESULT_BASE/config"
show_mount_opts >> "$RESULT_BASE/config"
if test -n "$SCRATCH_DEV_POOL" ; then
Expand Down
51 changes: 51 additions & 0 deletions test-appliance/files/root/runtests_utils
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ function get_fs_config()
fi
. "$FS_DIR/config"
FS_CONFIGURED="$fs"
MKFS_CONFIG_FILE=
if test -n "$MKFS_CONFIG" ; then
MKFS_CONFIG_FILE="$FS_DIR/mkfs_cfg/$MKFS_CONFIG.conf"
if ! test -f "$MKFS_CONFIG_FILE" ; then
MKFS_CONFIG_FILE=
fi
fi
return 0
}

Expand Down Expand Up @@ -101,6 +108,9 @@ function get_one_fs_config() {
echo "Unknown configuration $FS/$TC"
return 1
fi
if test -n "$adjust_mkfs_options" ; then
$adjust_mkfs_options
fi
if test -z "$TEST_DEV" ; then
if test -z "$SIZE" ; then
echo "No TEST_DEV and no SIZE"
Expand Down Expand Up @@ -279,6 +289,47 @@ function gen_version_files ()
test -n "$TC" && echo TEST_CFG=$TC >> $vi_sh
}

function set_mkfs_config
{
. /run/version_info.sh
case "$LINUX_VERSION_MAJOR" in
4)
case "$LINUX_VERSION_MINOR" in
19)
MKFS_CONFIG=lts_4.19
;;
esac
;;
5)
case "$LINUX_VERSION_MINOR" in
4)
MKFS_CONFIG=lts_5.4
;;
10)
MKFS_CONFIG=lts_5.10
;;
14|15)
# 5.14 is an honorary 5.15 for RHEL 9 and SLES 15 SP4+
MKFS_CONFIG=lts_5.15
;;
esac
;;
6)
case "$LINUX_VERSION_MINOR" in
1)
MKFS_CONFIG=lts_6.1
;;
6)
MKFS_CONFIG=lts_6.6
;;
12)
MKFS_CONFIG=lts_6.12
;;
esac
;;
esac
}

function clear_pool_devs ()
{
if test -n "$POOL0_DEV" ; then
Expand Down

0 comments on commit 01da22b

Please sign in to comment.