Re: [PATCH 04/16] xfs: clean up xfs_inactive a little bit

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

 



On Sun, Jun 13, 2021 at 10:20:18AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@xxxxxxxxxx>
> 
> Move the dqattach further up in xfs_inactive.  In theory we should
> always have dquots attached if there are CoW blocks, but this makes the
> usage pattern more consistent with the rest of xfs (attach dquots, then
> start making changes).
> 
> Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
> ---

Something like "xfs: attach dquots earlier in xfs_inactive()" might be a
more appropriate patch title..?

Otherwise seems reasonable:

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

(It also seems like this could be a standalone patch, merged
independently instead of carrying it around with this series.)

>  fs/xfs/xfs_inode.c |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> 
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 85b2b11b5217..67786814997c 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -1717,7 +1717,7 @@ xfs_inode_needs_inactive(
>   */
>  void
>  xfs_inactive(
> -	xfs_inode_t	*ip)
> +	struct xfs_inode	*ip)
>  {
>  	struct xfs_mount	*mp;
>  	int			error;
> @@ -1743,6 +1743,11 @@ xfs_inactive(
>  	if (xfs_is_metadata_inode(ip))
>  		goto out;
>  
> +	/* Ensure dquots are attached prior to making changes to this file. */
> +	error = xfs_qm_dqattach(ip);
> +	if (error)
> +		goto out;
> +
>  	/* Try to clean out the cow blocks if there are any. */
>  	if (xfs_inode_has_cow_data(ip))
>  		xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, true);
> @@ -1768,10 +1773,6 @@ xfs_inactive(
>  	     ip->i_df.if_nextents > 0 || ip->i_delayed_blks > 0))
>  		truncate = 1;
>  
> -	error = xfs_qm_dqattach(ip);
> -	if (error)
> -		goto out;
> -
>  	if (S_ISLNK(VFS_I(ip)->i_mode))
>  		error = xfs_inactive_symlink(ip);
>  	else if (truncate)
> 




[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