Re: [PATCH 09/20] xfs: factor out iclog size calculation from xlog_sync

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

 



On Thu, May 23, 2019 at 07:37:31PM +0200, Christoph Hellwig wrote:
> Split out another self-contained bit of code from xlog_sync.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  fs/xfs/xfs_log.c | 64 ++++++++++++++++++++++++++++--------------------
>  1 file changed, 38 insertions(+), 26 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 885470f08554..e2c9f74f86f3 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -1830,6 +1830,36 @@ xlog_split_iclog(
>  	return split_offset;
>  }
>  
> +static int
> +xlog_calc_iclog_size(
> +	struct xlog		*log,
> +	struct xlog_in_core	*iclog,
> +	uint32_t		*roundoff)
> +{
> +	bool			v2 = xfs_sb_version_haslogv2(&log->l_mp->m_sb);
> +	uint32_t		count_init, count;
> +
> +	/* Add for LR header */
> +	count_init = log->l_iclog_hsize + iclog->ic_offset;
> +
> +	/* Round out the log write size */
> +	if (v2 && log->l_mp->m_sb.sb_logsunit > 1) {

Hmmm, seeing as this is a now a standalone function, perhaps it
would make more sense to precalculate this whole check like so:

	bool			use_lsunit;

	use_lsunit = xfs_sb_version_haslogv2(&log->l_mp->m_sb) &&
			log->l_mp->m_sb.sb_logsunit > 1;

	if (use_lsunit) {
> +		/* we have a v2 stripe unit to use */
> +		count = XLOG_LSUNITTOB(log, XLOG_BTOLSUNIT(log, count_init));
> +	} else {
> +		count = BBTOB(BTOBB(count_init));
> +	}

Otherwise the patch looks good.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx



[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