public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-xfs@vger.kernel.org, Ian Kent <raven@themaw.net>
Subject: Re: [PATCH 6/7] xfs: clean up setting m_readio_* / m_writeio_*
Date: Sat, 26 Oct 2019 07:53:59 +1100	[thread overview]
Message-ID: <20191025205359.GG4614@dread.disaster.area> (raw)
In-Reply-To: <258d888c-e359-c264-33c3-910ebbd37bac@sandeen.net>

On Fri, Oct 25, 2019 at 02:18:02PM -0500, Eric Sandeen wrote:
> On 10/25/19 12:40 PM, Christoph Hellwig wrote:
> > Fill in the default _log values in xfs_parseargs similar to other
> > defaults, and open code the updates based on the on-disk superblock
> > in xfs_mountfs now that they are completely trivial.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  fs/xfs/xfs_mount.c | 36 +++++-------------------------------
> >  fs/xfs/xfs_super.c |  5 +++++
> >  2 files changed, 10 insertions(+), 31 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> > index 9800401a7d6f..bae53fdd5d51 100644
> > --- a/fs/xfs/xfs_mount.c
> > +++ b/fs/xfs/xfs_mount.c
> > @@ -425,35 +425,6 @@ xfs_update_alignment(xfs_mount_t *mp)
> >  	return 0;
> >  }
> >  
> > -/*
> > - * Set the default minimum read and write sizes unless
> > - * already specified in a mount option.
> > - * We use smaller I/O sizes when the file system
> > - * is being used for NFS service (wsync mount option).
> > - */
> > -STATIC void
> > -xfs_set_rw_sizes(xfs_mount_t *mp)
> > -{
> > -	xfs_sb_t	*sbp = &(mp->m_sb);
> > -	int		writeio_log;
> > -
> > -	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)) {
> > -		if (mp->m_flags & XFS_MOUNT_WSYNC)
> > -			writeio_log = XFS_WRITEIO_LOG_WSYNC;
> > -		else
> > -			writeio_log = XFS_WRITEIO_LOG_LARGE;
> > -	} else {
> > -		writeio_log = mp->m_writeio_log;
> > -	}
> > -
> > -	if (sbp->sb_blocklog > writeio_log) {
> > -		mp->m_writeio_log = sbp->sb_blocklog;
> > -	} else {
> > -		mp->m_writeio_log = writeio_log;
> > -	}
> > -	mp->m_writeio_blocks = 1 << (mp->m_writeio_log - sbp->sb_blocklog);
> > -}
> > -
> >  /*
> >   * precalculate the low space thresholds for dynamic speculative preallocation.
> >   */
> > @@ -718,9 +689,12 @@ xfs_mountfs(
> >  		goto out_remove_errortag;
> >  
> >  	/*
> > -	 * Set the minimum read and write sizes
> > +	 * Update the preferred write size based on the information from the
> > +	 * on-disk superblock.
> >  	 */
> > -	xfs_set_rw_sizes(mp);
> > +	mp->m_writeio_log =
> > +		max_t(uint32_t, mp->m_sb.sb_blocklog, mp->m_writeio_log);
> > +	mp->m_writeio_blocks = 1 << (mp->m_writeio_log - mp->m_sb.sb_blocklog);
> >  
> >  	/* set the low space thresholds for dynamic preallocation */
> >  	xfs_set_low_space_thresholds(mp);
> > diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> > index 1467f4bebc41..83dbfcc5a02d 100644
> > --- a/fs/xfs/xfs_super.c
> > +++ b/fs/xfs/xfs_super.c
> > @@ -405,6 +405,11 @@ xfs_parseargs(
> >  				XFS_MIN_IO_LOG, XFS_MAX_IO_LOG);
> >  			return -EINVAL;
> >  		}
> > +	} else {
> > +		if (mp->m_flags & XFS_MOUNT_WSYNC)
> > +			mp->m_writeio_log = XFS_WRITEIO_LOG_WSYNC;
> > +		else
> > +			mp->m_writeio_log = XFS_WRITEIO_LOG_LARGE;
> >  	}
> 
> Ok let's see, by here, if Opt_allocsize was specified, we set
> mp->m_writeio_log to the specified value, else if Opt_wsync was set, we 
> set m_writeio_log to XFS_WRITEIO_LOG_WSYNC (14), otherwise we default to
> XFS_WRITEIO_LOG_LARGE (16).  So that's it for parseargs.
> 
> AFAICT we can't escape parseargs w/ writeio_log less than PAGE_SHIFT
> (i.e. page size).

We can - 64k page size means XFS_WRITEIO_LOG_WSYNC is less than
PAGE_SHIFT, so it can escape here.

> Then in xfs_mountfs, you have it reset to the max of sb_blocklog and
> m_writeio_log.  i.e. it gets resized iff sb_blocklog is greater than
> the current m_writeio_log, which has a minimum of page size.
> 
> IOWS, it only gets a new value in mountfs if block size is > page size.

Which will never be true on 64k page size machines, but that's not
what this code does, anyway. It will rewrite m_writeio_log if the
block size is larger than the m_writeio_log value, so it preserves
the existing behaviour of setting the m_writeio_log value to a
minimum of one filesystem block....

Cheers,

Dave.

-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2019-10-25 20:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 17:40 decruft misc mount related code Christoph Hellwig
2019-10-25 17:40 ` [PATCH 1/7] xfs: cleanup stat blksize reporting Christoph Hellwig
2019-10-25 17:56   ` Eric Sandeen
2019-10-25 17:40 ` [PATCH 2/7] xfs: remove the unused m_readio_blocks field from struct xfs_mount Christoph Hellwig
2019-10-25 18:02   ` Eric Sandeen
2019-10-25 17:40 ` [PATCH 3/7] xfs: remove the m_readio_log " Christoph Hellwig
2019-10-25 18:26   ` Eric Sandeen
2019-10-25 20:43     ` Dave Chinner
2019-10-26  5:47       ` Christoph Hellwig
2019-10-25 17:40 ` [PATCH 4/7] xfs: remove the dsunit and dswidth variables in xfs_parseargs Christoph Hellwig
2019-10-25 18:29   ` Eric Sandeen
2019-10-25 17:40 ` [PATCH 5/7] xfs: remove the iosizelog variable " Christoph Hellwig
2019-10-25 18:35   ` Eric Sandeen
2019-10-25 19:03     ` Eric Sandeen
2019-10-26  5:47       ` Christoph Hellwig
2019-10-25 17:40 ` [PATCH 6/7] xfs: clean up setting m_readio_* / m_writeio_* Christoph Hellwig
2019-10-25 19:18   ` Eric Sandeen
2019-10-25 20:53     ` Dave Chinner [this message]
2019-10-27  2:23       ` Eric Sandeen
2019-10-25 17:40 ` [PATCH 7/7] xfs: reverse the polarity of XFS_MOUNT_COMPAT_IOSIZE Christoph Hellwig
2019-10-25 19:24   ` Eric Sandeen

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=20191025205359.GG4614@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    --cc=raven@themaw.net \
    --cc=sandeen@sandeen.net \
    /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