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

Dave Chinner
2025-02-12T21:23:37Z

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.
--
Dave Chinner
david@fromorbit.com