From aff502cc5e1bdf28bf5ae9c673f419df092634ce Mon Sep 17 00:00:00 2001 From: Jian Zhao Date: Thu, 18 Jun 2026 15:34:09 +0800 Subject: [PATCH] fix(fio): use kernel-compatible mkfs.xfs flags with fallback Older kernels (e.g. 5.4.x) cannot mount XFS filesystems created with newer on-disk features enabled by default in recent xfsprogs: inobtcount (>=5.16), bigtime (>=5.10) and nrext64 (>=6.0). Format XFS with these features disabled so the resulting filesystem mounts on older kernels. If the installed xfsprogs is too old to recognise the flags, fall back to plain 'mkfs.xfs -f'. Signed-off-by: Jian Zhao --- testcase/fio/fio.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/testcase/fio/fio.py b/testcase/fio/fio.py index 8c9599f5..baa00f89 100644 --- a/testcase/fio/fio.py +++ b/testcase/fio/fio.py @@ -136,9 +136,26 @@ class PerfFio(TSTPerf): umount_blkdev(blkdev=block_dev) return block_dev elif fs == "xfs": - mount_point = self.format_mount_fs( - block_dev=block_dev, fs=fs, format_cmd="mkfs.xfs -f" - ) + # Disable features not supported by older kernels (e.g. 5.4.x): + # inobtcount - inode btree counters (kernel >= 5.16) + # bigtime - timestamps beyond 2038 (kernel >= 5.10) + # nrext64 - 64-bit extent counters (kernel >= 6.0) + # Passing these flags requires xfsprogs >= 5.10; if the installed + # xfsprogs is too old to recognise them the fallback retries with + # plain mkfs.xfs -f so older environments still work. + mkfs_xfs_compat = "mkfs.xfs -f -m inobtcount=0 -m bigtime=0 -i nrext64=0" + mkfs_xfs_plain = "mkfs.xfs -f" + try: + mount_point = self.format_mount_fs( + block_dev=block_dev, fs=fs, format_cmd=mkfs_xfs_compat + ) + except Exception: + self.log( + "mkfs.xfs with compat flags failed, retrying with plain mkfs.xfs -f" + ) + mount_point = self.format_mount_fs( + block_dev=block_dev, fs=fs, format_cmd=mkfs_xfs_plain + ) elif fs == "ext4": mount_point = self.format_mount_fs( block_dev=block_dev, fs=fs, format_cmd="mkfs.ext4 -F" -- Gitee