public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Eric Sandeen <sandeen@redhat.com>, xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] mkfs: set inode alignment and cluster size for minimum log size estimation
Date: Fri, 7 Jul 2017 08:01:46 -0400	[thread overview]
Message-ID: <20170707120144.GD61756@bfoster.bfoster> (raw)
In-Reply-To: <20170707035152.GE4103@magnolia>

On Thu, Jul 06, 2017 at 08:51:52PM -0700, Darrick J. Wong wrote:
> In order for mkfs to calculate the minimum log size correctly, it must
> be able to find the transaction type with the largest reservation.  The
> iunlink transaction reservation size calculation depends on having the
> inode cluster size set correctly, which in turn depends on the inode
> alignment parameters being set as they will be in the final filesystem.
> Therefore we have to set up the inoalignmt field in max_trans_res.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  include/xfs_multidisk.h |    2 +-
>  libxfs/init.c           |    7 +++++++
>  mkfs/maxtrres.c         |   10 +++++++++-
>  mkfs/xfs_mkfs.c         |    3 ++-
>  4 files changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/include/xfs_multidisk.h b/include/xfs_multidisk.h
> index ce9bbce..e5f53b7 100644
> --- a/include/xfs_multidisk.h
> +++ b/include/xfs_multidisk.h
> @@ -69,6 +69,6 @@ extern void res_failed (int err);
>  extern int max_trans_res(unsigned long agsize, int crcs_enabled, int dirversion,
>  		int sectorlog, int blocklog, int inodelog, int dirblocklog,
>  		int logversion, int log_sunit, int finobt, int rmapbt,
> -		int reflink);
> +		int reflink, int inode_align);
>  
>  #endif	/* __XFS_MULTIDISK_H__ */
> diff --git a/libxfs/init.c b/libxfs/init.c
> index 3fb0fdf..d77a9e6 100644
> --- a/libxfs/init.c
> +++ b/libxfs/init.c
> @@ -707,6 +707,13 @@ libxfs_mount(
>  		mp->m_maxicount = 0;
>  
>  	mp->m_inode_cluster_size = XFS_INODE_BIG_CLUSTER_SIZE;
> +	if (xfs_sb_version_hascrc(&mp->m_sb)) {
> +		int	new_size = mp->m_inode_cluster_size;
> +
> +		new_size *= mp->m_sb.sb_inodesize / XFS_DINODE_MIN_SIZE;
> +		if (mp->m_sb.sb_inoalignmt >= XFS_B_TO_FSBT(mp, new_size))
> +			mp->m_inode_cluster_size = new_size;
> +	}
>  
>  	/*
>  	 * Set whether we're using stripe alignment.
> diff --git a/mkfs/maxtrres.c b/mkfs/maxtrres.c
> index 69ec67a..04028bf 100644
> --- a/mkfs/maxtrres.c
> +++ b/mkfs/maxtrres.c
> @@ -40,7 +40,8 @@ max_trans_res(
>  	int		log_sunit,
>  	int		finobt,
>  	int		rmapbt,
> -	int		reflink)
> +	int		reflink,
> +	int		inode_align)
>  {
>  	xfs_sb_t	*sbp;
>  	xfs_mount_t	mount;
> @@ -61,6 +62,13 @@ max_trans_res(
>  	sbp->sb_inopblock = 1 << (blocklog - inodelog);
>  	sbp->sb_dirblklog = dirblocklog - blocklog;
>  
> +	if (inode_align) {
> +		int	cluster_size = XFS_INODE_BIG_CLUSTER_SIZE;
> +		if (crcs_enabled)
> +			cluster_size *= sbp->sb_inodesize / XFS_DINODE_MIN_SIZE;
> +		sbp->sb_inoalignmt = cluster_size >> blocklog;
> +	}
> +
>  	if (log_sunit > 0) {
>  		log_sunit <<= blocklog;
>  		logversion = 2;
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index c839936..faa0e9a 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -2612,7 +2612,8 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),
>  				   sb_feat.crcs_enabled, sb_feat.dir_version,
>  				   sectorlog, blocklog, inodelog, dirblocklog,
>  				   sb_feat.log_version, lsunit, sb_feat.finobt,
> -				   sb_feat.rmapbt, sb_feat.reflink);
> +				   sb_feat.rmapbt, sb_feat.reflink,
> +				   sb_feat.inode_align);
>  	ASSERT(min_logblocks);
>  	min_logblocks = MAX(XFS_MIN_LOG_BLOCKS, min_logblocks);
>  	if (!logsize && dblocks >= (1024*1024*1024) >> blocklog)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-07-07 12:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-07  3:31 [PATCH] mkfs: set agblklog when we're verifying minimum log size Darrick J. Wong
2017-07-07  3:51 ` [PATCH] mkfs: set inode alignment and cluster size for minimum log size estimation Darrick J. Wong
2017-07-07 12:01   ` Brian Foster [this message]
2017-07-07 12:01 ` [PATCH] mkfs: set agblklog when we're verifying minimum log size Brian Foster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170707120144.GD61756@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox