Re: [PATCH 01/12] xfs: move eofblocks conversion function to xfs_ioctl.c

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

 



On Thu, May 21, 2020 at 07:53:32PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> Move xfs_fs_eofblocks_from_user into the only file that actually uses
> it, so that we don't have this function cluttering up the header file.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>
> ---

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

>  fs/xfs/xfs_icache.h |   35 -----------------------------------
>  fs/xfs/xfs_ioctl.c  |   35 +++++++++++++++++++++++++++++++++++
>  2 files changed, 35 insertions(+), 35 deletions(-)
> 
> 
> diff --git a/fs/xfs/xfs_icache.h b/fs/xfs/xfs_icache.h
> index 48f1fd2bb6ad..c13bc8a3e02f 100644
> --- a/fs/xfs/xfs_icache.h
> +++ b/fs/xfs/xfs_icache.h
> @@ -81,41 +81,6 @@ int xfs_inode_ag_iterator_tag(struct xfs_mount *mp,
>  	int (*execute)(struct xfs_inode *ip, int flags, void *args),
>  	int flags, void *args, int tag);
>  
> -static inline int
> -xfs_fs_eofblocks_from_user(
> -	struct xfs_fs_eofblocks		*src,
> -	struct xfs_eofblocks		*dst)
> -{
> -	if (src->eof_version != XFS_EOFBLOCKS_VERSION)
> -		return -EINVAL;
> -
> -	if (src->eof_flags & ~XFS_EOF_FLAGS_VALID)
> -		return -EINVAL;
> -
> -	if (memchr_inv(&src->pad32, 0, sizeof(src->pad32)) ||
> -	    memchr_inv(src->pad64, 0, sizeof(src->pad64)))
> -		return -EINVAL;
> -
> -	dst->eof_flags = src->eof_flags;
> -	dst->eof_prid = src->eof_prid;
> -	dst->eof_min_file_size = src->eof_min_file_size;
> -
> -	dst->eof_uid = INVALID_UID;
> -	if (src->eof_flags & XFS_EOF_FLAGS_UID) {
> -		dst->eof_uid = make_kuid(current_user_ns(), src->eof_uid);
> -		if (!uid_valid(dst->eof_uid))
> -			return -EINVAL;
> -	}
> -
> -	dst->eof_gid = INVALID_GID;
> -	if (src->eof_flags & XFS_EOF_FLAGS_GID) {
> -		dst->eof_gid = make_kgid(current_user_ns(), src->eof_gid);
> -		if (!gid_valid(dst->eof_gid))
> -			return -EINVAL;
> -	}
> -	return 0;
> -}
> -
>  int xfs_icache_inode_is_allocated(struct xfs_mount *mp, struct xfs_trans *tp,
>  				  xfs_ino_t ino, bool *inuse);
>  
> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> index 309958186d33..6a3c675a8aeb 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -2082,6 +2082,41 @@ xfs_ioc_setlabel(
>  	return error;
>  }
>  
> +static inline int
> +xfs_fs_eofblocks_from_user(
> +	struct xfs_fs_eofblocks		*src,
> +	struct xfs_eofblocks		*dst)
> +{
> +	if (src->eof_version != XFS_EOFBLOCKS_VERSION)
> +		return -EINVAL;
> +
> +	if (src->eof_flags & ~XFS_EOF_FLAGS_VALID)
> +		return -EINVAL;
> +
> +	if (memchr_inv(&src->pad32, 0, sizeof(src->pad32)) ||
> +	    memchr_inv(src->pad64, 0, sizeof(src->pad64)))
> +		return -EINVAL;
> +
> +	dst->eof_flags = src->eof_flags;
> +	dst->eof_prid = src->eof_prid;
> +	dst->eof_min_file_size = src->eof_min_file_size;
> +
> +	dst->eof_uid = INVALID_UID;
> +	if (src->eof_flags & XFS_EOF_FLAGS_UID) {
> +		dst->eof_uid = make_kuid(current_user_ns(), src->eof_uid);
> +		if (!uid_valid(dst->eof_uid))
> +			return -EINVAL;
> +	}
> +
> +	dst->eof_gid = INVALID_GID;
> +	if (src->eof_flags & XFS_EOF_FLAGS_GID) {
> +		dst->eof_gid = make_kgid(current_user_ns(), src->eof_gid);
> +		if (!gid_valid(dst->eof_gid))
> +			return -EINVAL;
> +	}
> +	return 0;
> +}
> +
>  /*
>   * Note: some of the ioctl's return positive numbers as a
>   * byte count indicating success, such as readlink_by_handle.
> 




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux