diff mbox series

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

Message ID 61a7e3f25621548ec3ef795a3cd0724e32afb647.1739363803.git.nirjhar.roy.lists@gmail.com (mailing list archive)
State New
Headers show
Series Add mount and remount related tests | expand

Commit Message

Nirjhar Roy (IBM) Feb. 12, 2025, 12:39 p.m. UTC
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(+)

Comments

Dave Chinner Feb. 12, 2025, 9:23 p.m. UTC | #1
On Wed, Feb 12, 2025 at 12:39:57PM +0000, Nirjhar Roy (IBM) wrote:
> 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"

This is testing mkfs.xfs, not the kernel.

We already have a helper for that: _scratch_mkfs_xfs_supported()

> +	_try_scratch_mount >/dev/null 2>&1
> +	ret="$?"
> +	_scratch_unmount
> +	[[ "$ret" != "0" ]] && _notrun "couldn't mount a V5 xfs filesystem"
> +}

This doesn't actually check that the mounted filesystem is a v5
format filesystem. That's what _require_scratch_xfs_crc() does.

Hence I don't see what this adds over _require_scratch_xfs_crc(),
which does the right thing on any mkfs.xfs released in the past
decade (i.e. when we changed mkfs.xfs to create v5 filesystems by
default). 

What test environment doesn't _require_scratch_xfs_crc() work for?

-Dave.
diff mbox series

Patch

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()