On Tue 17-02-26 16:47:26, Chuck Lever wrote:
> From: Chuck Lever <[email protected]>
> 
> Enable upper layers such as NFSD to retrieve case sensitivity
> information from file systems by adding FS_XFLAG_CASEFOLD and
> FS_XFLAG_CASENONPRESERVING flags.
> 
> Filesystems report case-insensitive or case-nonpreserving behavior
> by setting these flags directly in fa->fsx_xflags. The default
> (flags unset) indicates POSIX semantics: case-sensitive and
> case-preserving. These flags are read-only; userspace cannot set
> them via ioctl.
> 
> Case sensitivity information is exported to userspace via the
> fa_xflags field in the FS_IOC_FSGETXATTR ioctl and file_getattr()
> system call.
> 
> Reviewed-by: "Darrick J. Wong" <[email protected]>
> Signed-off-by: Chuck Lever <[email protected]>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

                                                                Honza

> ---
>  fs/file_attr.c           | 4 ++++
>  include/linux/fileattr.h | 3 ++-
>  include/uapi/linux/fs.h  | 7 +++++++
>  3 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/file_attr.c b/fs/file_attr.c
> index 42aa511111a0..5d9a7ed159fb 100644
> --- a/fs/file_attr.c
> +++ b/fs/file_attr.c
> @@ -37,6 +37,8 @@ void fileattr_fill_xflags(struct file_kattr *fa, u32 xflags)
>               fa->flags |= FS_PROJINHERIT_FL;
>       if (fa->fsx_xflags & FS_XFLAG_VERITY)
>               fa->flags |= FS_VERITY_FL;
> +     if (fa->fsx_xflags & FS_XFLAG_CASEFOLD)
> +             fa->flags |= FS_CASEFOLD_FL;
>  }
>  EXPORT_SYMBOL(fileattr_fill_xflags);
>  
> @@ -67,6 +69,8 @@ void fileattr_fill_flags(struct file_kattr *fa, u32 flags)
>               fa->fsx_xflags |= FS_XFLAG_PROJINHERIT;
>       if (fa->flags & FS_VERITY_FL)
>               fa->fsx_xflags |= FS_XFLAG_VERITY;
> +     if (fa->flags & FS_CASEFOLD_FL)
> +             fa->fsx_xflags |= FS_XFLAG_CASEFOLD;
>  }
>  EXPORT_SYMBOL(fileattr_fill_flags);
>  
> diff --git a/include/linux/fileattr.h b/include/linux/fileattr.h
> index 3780904a63a6..58044b598016 100644
> --- a/include/linux/fileattr.h
> +++ b/include/linux/fileattr.h
> @@ -16,7 +16,8 @@
>  
>  /* Read-only inode flags */
>  #define FS_XFLAG_RDONLY_MASK \
> -     (FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR | FS_XFLAG_VERITY)
> +     (FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR | FS_XFLAG_VERITY | \
> +      FS_XFLAG_CASEFOLD | FS_XFLAG_CASENONPRESERVING)
>  
>  /* Flags to indicate valid value of fsx_ fields */
>  #define FS_XFLAG_VALUES_MASK \
> diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
> index 70b2b661f42c..2fa003575e8b 100644
> --- a/include/uapi/linux/fs.h
> +++ b/include/uapi/linux/fs.h
> @@ -254,6 +254,13 @@ struct file_attr {
>  #define FS_XFLAG_DAX         0x00008000      /* use DAX for IO */
>  #define FS_XFLAG_COWEXTSIZE  0x00010000      /* CoW extent size allocator 
> hint */
>  #define FS_XFLAG_VERITY              0x00020000      /* fs-verity enabled */
> +/*
> + * Case handling flags (read-only, cannot be set via ioctl).
> + * Default (neither set) indicates POSIX semantics: case-sensitive
> + * lookups and case-preserving storage.
> + */
> +#define FS_XFLAG_CASEFOLD    0x00040000      /* case-insensitive lookups */
> +#define FS_XFLAG_CASENONPRESERVING 0x00080000        /* case not preserved */
>  #define FS_XFLAG_HASATTR     0x80000000      /* no DIFLAG for this   */
>  
>  /* the read-only stuff doesn't really belong here, but any other place is
> -- 
> 2.53.0
> 
-- 
Jan Kara <[email protected]>
SUSE Labs, CR


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to