Re: [PATCH 4/2] xfs: simplify xlog_recover_inode_ra_pass2

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

 



On Mon, Apr 27, 2020 at 09:33:49PM +0200, Christoph Hellwig wrote:
> Don't bother to allocate memory and convert the log item when we
> only need the block number and the length.  Just extract them directly
> and call xlog_buf_readahead separately in each branch.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

>  fs/xfs/xfs_log_recover.c | 21 ++++++++-------------
>  1 file changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 4cb8f24f3aa63..fe4dad5b77a95 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -3890,22 +3890,17 @@ xlog_recover_inode_ra_pass2(
>  	struct xlog                     *log,
>  	struct xlog_recover_item        *item)
>  {
> -	struct xfs_inode_log_format	ilf_buf;
> -	struct xfs_inode_log_format	*ilfp;
> -	int			error;
> -
>  	if (item->ri_buf[0].i_len == sizeof(struct xfs_inode_log_format)) {
> -		ilfp = item->ri_buf[0].i_addr;
> +		struct xfs_inode_log_format	*ilfp = item->ri_buf[0].i_addr;
> +
> +		xlog_buf_readahead(log, ilfp->ilf_blkno, ilfp->ilf_len,
> +				   &xfs_inode_buf_ra_ops);
>  	} else {
> -		ilfp = &ilf_buf;
> -		memset(ilfp, 0, sizeof(*ilfp));
> -		error = xfs_inode_item_format_convert(&item->ri_buf[0], ilfp);
> -		if (error)
> -			return;
> -	}
> +		struct xfs_inode_log_format_32	*ilfp = item->ri_buf[0].i_addr;
>  
> -	xlog_buf_readahead(log, ilfp->ilf_blkno, ilfp->ilf_len,
> -			   &xfs_inode_buf_ra_ops);
> +		xlog_buf_readahead(log, ilfp->ilf_blkno, ilfp->ilf_len,
> +				   &xfs_inode_buf_ra_ops);
> +	}
>  }
>  
>  STATIC void
> -- 
> 2.26.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