Re: [PATCH V4 RESEND 5/7] xfs: xfs_attr_calc_size: Explicitly pass mp, namelen and valuelen args

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

 



On Mon, Feb 24, 2020 at 09:30:42AM +0530, Chandan Rajendra wrote:
> In a future commit, xfs_attr_calc_size() will be invoked from a function that
> does not have a 'struct xfs_da_args' handy. Hence this commit changes
> xfs_attr_calc_size() to let invokers to explicitly pass 'struct xfs_mount *',
> namelen and valuelen arguments.
> 
> Signed-off-by: Chandan Rajendra <chandanrlinux@xxxxxxxxx>
> ---

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

>  fs/xfs/libxfs/xfs_attr.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> index 921acac71e5d9..f781724bf85ce 100644
> --- a/fs/xfs/libxfs/xfs_attr.c
> +++ b/fs/xfs/libxfs/xfs_attr.c
> @@ -138,22 +138,24 @@ xfs_attr_get(
>   */
>  STATIC void
>  xfs_attr_calc_size(
> -	struct xfs_da_args		*args,
> +	struct xfs_mount		*mp,
>  	struct xfs_attr_set_resv	*resv,
> +	int				namelen,
> +	int				valuelen,
>  	int				*local)
>  {
> -	struct xfs_mount		*mp = args->dp->i_mount;
> +	unsigned int			blksize = mp->m_attr_geo->blksize;
>  	int				size;
>  
>  	/*
>  	 * Determine space new attribute will use, and if it would be
>  	 * "local" or "remote" (note: local != inline).
>  	 */
> -	size = xfs_attr_leaf_newentsize(args->geo, args->namelen,
> -			args->valuelen, local);
> +	size = xfs_attr_leaf_newentsize(mp->m_attr_geo, namelen, valuelen,
> +			local);
>  	resv->total_dablks = XFS_DAENTER_BLOCKS(mp, XFS_ATTR_FORK);
>  	if (*local) {
> -		if (size > (args->geo->blksize / 2)) {
> +		if (size > (blksize / 2)) {
>  			/* Double split possible */
>  			resv->total_dablks *= 2;
>  		}
> @@ -163,7 +165,7 @@ xfs_attr_calc_size(
>  		 * Out of line attribute, cannot double split, but
>  		 * make room for the attribute value itself.
>  		 */
> -		resv->rmt_blks = xfs_attr3_rmt_blocks(mp, args->valuelen);
> +		resv->rmt_blks = xfs_attr3_rmt_blocks(mp, valuelen);
>  	}
>  
>  	resv->bmbt_blks = XFS_NEXTENTADD_SPACE_RES(mp,
> @@ -329,7 +331,8 @@ xfs_attr_set(
>  		XFS_STATS_INC(mp, xs_attr_set);
>  
>  		args->op_flags |= XFS_DA_OP_ADDNAME;
> -		xfs_attr_calc_size(args, &resv, &local);
> +		xfs_attr_calc_size(mp, &resv, args->namelen, args->valuelen,
> +				&local);
>  		args->total = resv.alloc_blks;
>  
>  		/*
> -- 
> 2.19.1
> 




[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