Re: [PATCH v3] common/casefold: Support for tmpfs casefold test

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



André Almeida <andrealmeid@xxxxxxxxxx> writes:

> Test casefold support for tmpfs.
>
> Signed-off-by: André Almeida <andrealmeid@xxxxxxxxxx>
> ---
>  common/casefold   | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>  common/rc         |  3 +++
>  tests/generic/556 | 12 ++++++++----
>  3 files changed, 57 insertions(+), 4 deletions(-)
>
> diff --git a/common/casefold b/common/casefold
> index d9126f4c..2aae5e5e 100644
> --- a/common/casefold
> +++ b/common/casefold
> @@ -12,6 +12,9 @@ _has_casefold_kernel_support()
>  	f2fs)
>  		test -f '/sys/fs/f2fs/features/casefold'
>  		;;
> +	tmpfs)
> +		test -f '/sys/fs/tmpfs/features/casefold'
> +		;;
>  	*)
>  		# defaults to unsupported
>  		false
> @@ -52,6 +55,9 @@ _scratch_mkfs_casefold()
>  	f2fs)
>  		_scratch_mkfs -C utf8 $*
>  		;;
> +	tmpfs)
> +		# there's no mkfs for tmpfs, just return
> +		;;
>  	*)
>  		_notrun "Don't know how to mkfs with casefold support on $FSTYP"
>  		;;
> @@ -67,12 +73,52 @@ _scratch_mkfs_casefold_strict()
>  	f2fs)
>  		_scratch_mkfs -C utf8:strict
>  		;;
> +	tmpfs)
> +		# there's no mkfs for tmpfs, just return
> +		;;
>  	*)
>  		_notrun "Don't know how to mkfs with casefold-strict support on $FSTYP"
>  		;;
>  	esac
>  }
>  
> +_scratch_mount_casefold()
> +{
> +	case $FSTYP in
> +	ext4)
> +		_scratch_mount
> +		;;
> +	f2fs)
> +		_scratch_mount
> +		;;
> +	tmpfs)
> +		mount -t tmpfs -o casefold tmpfs $SCRATCH_MNT
> +		;;
> +	*)
> +		_notrun "Don't know how to mount with casefold support on $FSTYP"
> +		;;
> +	esac
> +}

> +
> +_scratch_mount_casefold_strict()
> +{
> +	case $FSTYP in
> +	ext4)
> +		_scratch_mount
> +		;;
> +	f2fs)
> +		_scratch_mount
> +		;;
> +	tmpfs)
> +		mount -t tmpfs -o casefold,strict_encoding tmpfs $SCRATCH_MNT
> +		;;
> +	*)
> +		_notrun "Don't know how to mount with casefold support on $FSTYP"
> +		;;
> +	esac
> +}
> +

Now, I noticed there is some infrastructure to provide mount options
through _scratch_mount_options that would be a better fit for this
instead of the custom handlers I previously suggested.

Either way, the test looks good to me:

Reviewed-by: Gabriel Krisman Bertazi <gabriel@xxxxxxxxxx>

-- 
Gabriel Krisman Bertazi





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux