[PATCH v1 2/3] common/xfs: Add a new helper function to check v5 XFS

Nirjhar Roy (IBM)
2025-02-12T12:41:55Z

This commit adds a new helper to function to check that we can
create a V5 XFS filesystem in the scratch device

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
---
common/xfs | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/common/xfs b/common/xfs
index 0417a40a..cc0a62e4 100644
--- a/common/xfs
+++ b/common/xfs
@@ -468,6 +468,19 @@ _require_scratch_xfs_crc()
_scratch_unmount
}

+# this test requires the xfs kernel support crc feature on scratch device
+#
+_require_scratch_xfs_v5()
+{
+ _require_scratch_xfs_crc
+ _scratch_mkfs_xfs -m crc=1 > $seqres.full 2>&1 ||
+ _notrun "v5 filesystem isn't supported by the kernel"
+ _try_scratch_mount >/dev/null 2>&1
+ ret="$?"
+ _scratch_unmount
+ [[ "$ret" != "0" ]] && _notrun "couldn't mount a V5 xfs filesystem"
+}
+
# this test requires the finobt feature to be available in mkfs.xfs
#
_require_xfs_mkfs_finobt()
--
2.34.1