linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* decruft misc mount related code v2
@ 2019-10-27 14:55 Christoph Hellwig
  2019-10-27 14:55 ` [PATCH 01/12] xfs: remove the biosize mount option Christoph Hellwig
                   ` (11 more replies)
  0 siblings, 12 replies; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-27 14:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Ian Kent

Hi all,

this series decrufts various bits of vaguely mount / mount option
related code.  The background is the mount API from series, which
currently is a lot more ugly than it should be do the way how
we parse two mount options with arguments into local variables
instead of directly into the mount structure.  This series cleans
that and a few nearby warts.

Changes since v1:
 - document the behavior change for allocsize=0
 - pick up the patch to remove the biosize option from the mount API
   series
 - remove the -o wsync allocsize hack entirely
 - remove the m_readio_* fields entirely
 - rename the m_writeio_* fields to m_allocio_*
 - more tweaks to xfs_parseargs
 - clean up printing the mount options

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 01/12] xfs: remove the biosize mount option
  2019-10-27 14:55 decruft misc mount related code v2 Christoph Hellwig
@ 2019-10-27 14:55 ` Christoph Hellwig
  2019-10-27 14:55 ` [PATCH 02/12] xfs: remove the dsunit and dswidth variables in xfs_parseargs Christoph Hellwig
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-27 14:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Ian Kent, Brian Foster, Darrick J . Wong

From: Ian Kent <raven@themaw.net>

It appears the biosize mount option hasn't been documented as a valid
option since 2005, remove it.

Signed-off-by: Ian Kent <raven@themaw.net>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_super.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 0a8cf6b87a21..589c080cabfe 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -50,7 +50,7 @@ static struct xfs_kobj xfs_dbg_kobj;	/* global debug sysfs attrs */
  * Table driven mount option parser.
  */
 enum {
-	Opt_logbufs, Opt_logbsize, Opt_logdev, Opt_rtdev, Opt_biosize,
+	Opt_logbufs, Opt_logbsize, Opt_logdev, Opt_rtdev,
 	Opt_wsync, Opt_noalign, Opt_swalloc, Opt_sunit, Opt_swidth, Opt_nouuid,
 	Opt_grpid, Opt_nogrpid, Opt_bsdgroups, Opt_sysvgroups,
 	Opt_allocsize, Opt_norecovery, Opt_inode64, Opt_inode32, Opt_ikeep,
@@ -66,7 +66,6 @@ static const match_table_t tokens = {
 	{Opt_logbsize,	"logbsize=%s"},	/* size of XFS log buffers */
 	{Opt_logdev,	"logdev=%s"},	/* log device */
 	{Opt_rtdev,	"rtdev=%s"},	/* realtime I/O device */
-	{Opt_biosize,	"biosize=%u"},	/* log2 of preferred buffered io size */
 	{Opt_wsync,	"wsync"},	/* safe-mode nfs compatible mount */
 	{Opt_noalign,	"noalign"},	/* turn off stripe alignment */
 	{Opt_swalloc,	"swalloc"},	/* turn on stripe width allocation */
@@ -228,7 +227,6 @@ xfs_parseargs(
 				return -ENOMEM;
 			break;
 		case Opt_allocsize:
-		case Opt_biosize:
 			if (suffix_kstrtoint(args, 10, &iosize))
 				return -EINVAL;
 			iosizelog = ffs(iosize) - 1;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 02/12] xfs: remove the dsunit and dswidth variables in xfs_parseargs
  2019-10-27 14:55 decruft misc mount related code v2 Christoph Hellwig
  2019-10-27 14:55 ` [PATCH 01/12] xfs: remove the biosize mount option Christoph Hellwig
@ 2019-10-27 14:55 ` Christoph Hellwig
  2019-10-28 16:50   ` Darrick J. Wong
  2019-10-27 14:55 ` [PATCH 03/12] xfs: cleanup calculating the stat optimal I/O size Christoph Hellwig
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-27 14:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Ian Kent, Eric Sandeen

There is no real need for the local variables here - either they
are applied to the mount structure, or if the noalign mount option
is set the mount will fail entirely if either is set.  Removing
them helps cleaning up the mount API conversion.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
---
 fs/xfs/xfs_super.c | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 589c080cabfe..4089de3daded 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -159,8 +159,6 @@ xfs_parseargs(
 	const struct super_block *sb = mp->m_super;
 	char			*p;
 	substring_t		args[MAX_OPT_ARGS];
-	int			dsunit = 0;
-	int			dswidth = 0;
 	int			iosize = 0;
 	uint8_t			iosizelog = 0;
 
@@ -252,11 +250,11 @@ xfs_parseargs(
 			mp->m_flags |= XFS_MOUNT_SWALLOC;
 			break;
 		case Opt_sunit:
-			if (match_int(args, &dsunit))
+			if (match_int(args, &mp->m_dalign))
 				return -EINVAL;
 			break;
 		case Opt_swidth:
-			if (match_int(args, &dswidth))
+			if (match_int(args, &mp->m_swidth))
 				return -EINVAL;
 			break;
 		case Opt_inode32:
@@ -350,7 +348,8 @@ xfs_parseargs(
 		return -EINVAL;
 	}
 
-	if ((mp->m_flags & XFS_MOUNT_NOALIGN) && (dsunit || dswidth)) {
+	if ((mp->m_flags & XFS_MOUNT_NOALIGN) &&
+	    (mp->m_dalign || mp->m_swidth)) {
 		xfs_warn(mp,
 	"sunit and swidth options incompatible with the noalign option");
 		return -EINVAL;
@@ -363,30 +362,20 @@ xfs_parseargs(
 	}
 #endif
 
-	if ((dsunit && !dswidth) || (!dsunit && dswidth)) {
+	if ((mp->m_dalign && !mp->m_swidth) ||
+	    (!mp->m_dalign && mp->m_swidth)) {
 		xfs_warn(mp, "sunit and swidth must be specified together");
 		return -EINVAL;
 	}
 
-	if (dsunit && (dswidth % dsunit != 0)) {
+	if (mp->m_dalign && (mp->m_swidth % mp->m_dalign != 0)) {
 		xfs_warn(mp,
 	"stripe width (%d) must be a multiple of the stripe unit (%d)",
-			dswidth, dsunit);
+			mp->m_swidth, mp->m_dalign);
 		return -EINVAL;
 	}
 
 done:
-	if (dsunit && !(mp->m_flags & XFS_MOUNT_NOALIGN)) {
-		/*
-		 * At this point the superblock has not been read
-		 * in, therefore we do not know the block size.
-		 * Before the mount call ends we will convert
-		 * these to FSBs.
-		 */
-		mp->m_dalign = dsunit;
-		mp->m_swidth = dswidth;
-	}
-
 	if (mp->m_logbufs != -1 &&
 	    mp->m_logbufs != 0 &&
 	    (mp->m_logbufs < XLOG_MIN_ICLOGS ||
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 03/12] xfs: cleanup calculating the stat optimal I/O size
  2019-10-27 14:55 decruft misc mount related code v2 Christoph Hellwig
  2019-10-27 14:55 ` [PATCH 01/12] xfs: remove the biosize mount option Christoph Hellwig
  2019-10-27 14:55 ` [PATCH 02/12] xfs: remove the dsunit and dswidth variables in xfs_parseargs Christoph Hellwig
@ 2019-10-27 14:55 ` Christoph Hellwig
  2019-10-28 16:50   ` Darrick J. Wong
  2019-10-27 14:55 ` [PATCH 04/12] xfs: don't use a different allocsice for -o wsync mounts Christoph Hellwig
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-27 14:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Ian Kent, Eric Sandeen

Move xfs_preferred_iosize to xfs_iops.c, unobsfucate it and also handle
the realtime special case in the helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
---
 fs/xfs/xfs_iops.c  | 47 ++++++++++++++++++++++++++++++++++++----------
 fs/xfs/xfs_mount.h | 24 -----------------------
 2 files changed, 37 insertions(+), 34 deletions(-)

diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 404f2dd58698..b6dbfd8eb6a1 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -484,6 +484,42 @@ xfs_vn_get_link_inline(
 	return link;
 }
 
+static uint32_t
+xfs_stat_blksize(
+	struct xfs_inode	*ip)
+{
+	struct xfs_mount	*mp = ip->i_mount;
+
+	/*
+	 * If the file blocks are being allocated from a realtime volume, then
+	 * always return the realtime extent size.
+	 */
+	if (XFS_IS_REALTIME_INODE(ip))
+		return xfs_get_extsz_hint(ip) << mp->m_sb.sb_blocklog;
+
+	/*
+	 * Allow large block sizes to be reported to userspace programs if the
+	 * "largeio" mount option is used.
+	 *
+	 * If compatibility mode is specified, simply return the basic unit of
+	 * caching so that we don't get inefficient read/modify/write I/O from
+	 * user apps. Otherwise....
+	 *
+	 * If the underlying volume is a stripe, then return the stripe width in
+	 * bytes as the recommended I/O size. It is not a stripe and we've set a
+	 * default buffered I/O size, return that, otherwise return the compat
+	 * default.
+	 */
+	if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE)) {
+		if (mp->m_swidth)
+			return mp->m_swidth << mp->m_sb.sb_blocklog;
+		if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
+			return 1U << max(mp->m_readio_log, mp->m_writeio_log);
+	}
+
+	return PAGE_SIZE;
+}
+
 STATIC int
 xfs_vn_getattr(
 	const struct path	*path,
@@ -543,16 +579,7 @@ xfs_vn_getattr(
 		stat->rdev = inode->i_rdev;
 		break;
 	default:
-		if (XFS_IS_REALTIME_INODE(ip)) {
-			/*
-			 * If the file blocks are being allocated from a
-			 * realtime volume, then return the inode's realtime
-			 * extent size or the realtime volume's extent size.
-			 */
-			stat->blksize =
-				xfs_get_extsz_hint(ip) << mp->m_sb.sb_blocklog;
-		} else
-			stat->blksize = xfs_preferred_iosize(mp);
+		stat->blksize = xfs_stat_blksize(ip);
 		stat->rdev = 0;
 		break;
 	}
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index fdb60e09a9c5..f69e370db341 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -267,30 +267,6 @@ typedef struct xfs_mount {
 #define	XFS_WSYNC_READIO_LOG	15	/* 32k */
 #define	XFS_WSYNC_WRITEIO_LOG	14	/* 16k */
 
-/*
- * Allow large block sizes to be reported to userspace programs if the
- * "largeio" mount option is used.
- *
- * If compatibility mode is specified, simply return the basic unit of caching
- * so that we don't get inefficient read/modify/write I/O from user apps.
- * Otherwise....
- *
- * If the underlying volume is a stripe, then return the stripe width in bytes
- * as the recommended I/O size. It is not a stripe and we've set a default
- * buffered I/O size, return that, otherwise return the compat default.
- */
-static inline unsigned long
-xfs_preferred_iosize(xfs_mount_t *mp)
-{
-	if (mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE)
-		return PAGE_SIZE;
-	return (mp->m_swidth ?
-		(mp->m_swidth << mp->m_sb.sb_blocklog) :
-		((mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) ?
-			(1 << (int)max(mp->m_readio_log, mp->m_writeio_log)) :
-			PAGE_SIZE));
-}
-
 #define XFS_LAST_UNMOUNT_WAS_CLEAN(mp)	\
 				((mp)->m_flags & XFS_MOUNT_WAS_CLEAN)
 #define XFS_FORCED_SHUTDOWN(mp)	((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 04/12] xfs: don't use a different allocsice for -o wsync mounts
  2019-10-27 14:55 decruft misc mount related code v2 Christoph Hellwig
                   ` (2 preceding siblings ...)
  2019-10-27 14:55 ` [PATCH 03/12] xfs: cleanup calculating the stat optimal I/O size Christoph Hellwig
@ 2019-10-27 14:55 ` Christoph Hellwig
  2019-10-28 17:05   ` Darrick J. Wong
  2019-10-27 14:55 ` [PATCH 05/12] xfs: remove the m_readio_* fields in struct xfs_mount Christoph Hellwig
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-27 14:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Ian Kent

The -o wsync allocsize overwrite overwrite was part of a special hack
for NFSv2 servers in IRIX and has no real purpose in modern Linux, so
remove it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_mount.c | 9 ++-------
 fs/xfs/xfs_mount.h | 7 -------
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index ba5b6f3b2b88..b423033e14f4 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -438,13 +438,8 @@ xfs_set_rw_sizes(xfs_mount_t *mp)
 	int		readio_log, writeio_log;
 
 	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)) {
-		if (mp->m_flags & XFS_MOUNT_WSYNC) {
-			readio_log = XFS_WSYNC_READIO_LOG;
-			writeio_log = XFS_WSYNC_WRITEIO_LOG;
-		} else {
-			readio_log = XFS_READIO_LOG_LARGE;
-			writeio_log = XFS_WRITEIO_LOG_LARGE;
-		}
+		readio_log = XFS_READIO_LOG_LARGE;
+		writeio_log = XFS_WRITEIO_LOG_LARGE;
 	} else {
 		readio_log = mp->m_readio_log;
 		writeio_log = mp->m_writeio_log;
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index f69e370db341..dc81e5c264ce 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -260,13 +260,6 @@ typedef struct xfs_mount {
 #define XFS_MAX_IO_LOG		30	/* 1G */
 #define XFS_MIN_IO_LOG		PAGE_SHIFT
 
-/*
- * Synchronous read and write sizes.  This should be
- * better for NFSv2 wsync filesystems.
- */
-#define	XFS_WSYNC_READIO_LOG	15	/* 32k */
-#define	XFS_WSYNC_WRITEIO_LOG	14	/* 16k */
-
 #define XFS_LAST_UNMOUNT_WAS_CLEAN(mp)	\
 				((mp)->m_flags & XFS_MOUNT_WAS_CLEAN)
 #define XFS_FORCED_SHUTDOWN(mp)	((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 05/12] xfs: remove the m_readio_* fields in struct xfs_mount
  2019-10-27 14:55 decruft misc mount related code v2 Christoph Hellwig
                   ` (3 preceding siblings ...)
  2019-10-27 14:55 ` [PATCH 04/12] xfs: don't use a different allocsice for -o wsync mounts Christoph Hellwig
@ 2019-10-27 14:55 ` Christoph Hellwig
  2019-10-28 17:06   ` Darrick J. Wong
  2019-10-27 14:55 ` [PATCH 06/12] xfs: rename the m_writeio_* " Christoph Hellwig
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-27 14:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Ian Kent

m_readio_blocks is entirely unused, and m_readio_blocks is only used in
xfs_stat_blksize in a max statements that is a no-op as it always has
the same value as m_writeio_log.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_iops.c  |  2 +-
 fs/xfs/xfs_mount.c | 18 ++++--------------
 fs/xfs/xfs_mount.h |  5 +----
 fs/xfs/xfs_super.c |  1 -
 4 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index b6dbfd8eb6a1..271fcbe04d48 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -514,7 +514,7 @@ xfs_stat_blksize(
 		if (mp->m_swidth)
 			return mp->m_swidth << mp->m_sb.sb_blocklog;
 		if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
-			return 1U << max(mp->m_readio_log, mp->m_writeio_log);
+			return 1U << mp->m_writeio_log;
 	}
 
 	return PAGE_SIZE;
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index b423033e14f4..359fcfb494d4 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -437,25 +437,15 @@ xfs_set_rw_sizes(xfs_mount_t *mp)
 	xfs_sb_t	*sbp = &(mp->m_sb);
 	int		readio_log, writeio_log;
 
-	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)) {
-		readio_log = XFS_READIO_LOG_LARGE;
+	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE))
 		writeio_log = XFS_WRITEIO_LOG_LARGE;
-	} else {
-		readio_log = mp->m_readio_log;
+	else
 		writeio_log = mp->m_writeio_log;
-	}
 
-	if (sbp->sb_blocklog > readio_log) {
-		mp->m_readio_log = sbp->sb_blocklog;
-	} else {
-		mp->m_readio_log = readio_log;
-	}
-	mp->m_readio_blocks = 1 << (mp->m_readio_log - sbp->sb_blocklog);
-	if (sbp->sb_blocklog > writeio_log) {
+	if (sbp->sb_blocklog > writeio_log)
 		mp->m_writeio_log = sbp->sb_blocklog;
-	} else {
+	} else
 		mp->m_writeio_log = writeio_log;
-	}
 	mp->m_writeio_blocks = 1 << (mp->m_writeio_log - sbp->sb_blocklog);
 }
 
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index dc81e5c264ce..fba818d5c540 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -98,8 +98,6 @@ typedef struct xfs_mount {
 	xfs_agnumber_t		m_agirotor;	/* last ag dir inode alloced */
 	spinlock_t		m_agirotor_lock;/* .. and lock protecting it */
 	xfs_agnumber_t		m_maxagi;	/* highest inode alloc group */
-	uint			m_readio_log;	/* min read size log bytes */
-	uint			m_readio_blocks; /* min read size blocks */
 	uint			m_writeio_log;	/* min write size log bytes */
 	uint			m_writeio_blocks; /* min write size blocks */
 	struct xfs_da_geometry	*m_dir_geo;	/* directory block geometry */
@@ -248,9 +246,8 @@ typedef struct xfs_mount {
 
 
 /*
- * Default minimum read and write sizes.
+ * Default write size.
  */
-#define XFS_READIO_LOG_LARGE	16
 #define XFS_WRITEIO_LOG_LARGE	16
 
 /*
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 4089de3daded..a477348ab68b 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -405,7 +405,6 @@ xfs_parseargs(
 		}
 
 		mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
-		mp->m_readio_log = iosizelog;
 		mp->m_writeio_log = iosizelog;
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 06/12] xfs: rename the m_writeio_* fields in struct xfs_mount
  2019-10-27 14:55 decruft misc mount related code v2 Christoph Hellwig
                   ` (4 preceding siblings ...)
  2019-10-27 14:55 ` [PATCH 05/12] xfs: remove the m_readio_* fields in struct xfs_mount Christoph Hellwig
@ 2019-10-27 14:55 ` Christoph Hellwig
  2019-10-28 17:07   ` Darrick J. Wong
  2019-10-27 14:55 ` [PATCH 07/12] xfs: simplify parsing of allocsize mount option Christoph Hellwig
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-27 14:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Ian Kent

Use the allocsize name to match the mount option and usage instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_iomap.c | 16 ++++++++--------
 fs/xfs/xfs_iops.c  |  2 +-
 fs/xfs/xfs_mount.c |  8 ++++----
 fs/xfs/xfs_mount.h |  4 ++--
 fs/xfs/xfs_super.c |  4 ++--
 fs/xfs/xfs_trace.h |  2 +-
 6 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 4af50b101d2b..64bd30a24a71 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -29,8 +29,8 @@
 #include "xfs_reflink.h"
 
 
-#define XFS_WRITEIO_ALIGN(mp,off)	(((off) >> mp->m_writeio_log) \
-						<< mp->m_writeio_log)
+#define XFS_ALLOC_ALIGN(mp, off) \
+	(((off) >> mp->m_allocsize_log) << mp->m_allocsize_log)
 
 static int
 xfs_alert_fsblock_zero(
@@ -391,7 +391,7 @@ xfs_iomap_prealloc_size(
 		return 0;
 
 	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) &&
-	    (XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_writeio_blocks)))
+	    (XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_allocsize_blocks)))
 		return 0;
 
 	/*
@@ -402,7 +402,7 @@ xfs_iomap_prealloc_size(
 	    XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_dalign) ||
 	    !xfs_iext_peek_prev_extent(ifp, icur, &prev) ||
 	    prev.br_startoff + prev.br_blockcount < offset_fsb)
-		return mp->m_writeio_blocks;
+		return mp->m_allocsize_blocks;
 
 	/*
 	 * Determine the initial size of the preallocation. We are beyond the
@@ -495,10 +495,10 @@ xfs_iomap_prealloc_size(
 	while (alloc_blocks && alloc_blocks >= freesp)
 		alloc_blocks >>= 4;
 check_writeio:
-	if (alloc_blocks < mp->m_writeio_blocks)
-		alloc_blocks = mp->m_writeio_blocks;
+	if (alloc_blocks < mp->m_allocsize_blocks)
+		alloc_blocks = mp->m_allocsize_blocks;
 	trace_xfs_iomap_prealloc_size(ip, alloc_blocks, shift,
-				      mp->m_writeio_blocks);
+				      mp->m_allocsize_blocks);
 	return alloc_blocks;
 }
 
@@ -962,7 +962,7 @@ xfs_buffered_write_iomap_begin(
 			xfs_off_t	end_offset;
 			xfs_fileoff_t	p_end_fsb;
 
-			end_offset = XFS_WRITEIO_ALIGN(mp, offset + count - 1);
+			end_offset = XFS_ALLOC_ALIGN(mp, offset + count - 1);
 			p_end_fsb = XFS_B_TO_FSBT(mp, end_offset) +
 					prealloc_blocks;
 
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 271fcbe04d48..382d72769470 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -514,7 +514,7 @@ xfs_stat_blksize(
 		if (mp->m_swidth)
 			return mp->m_swidth << mp->m_sb.sb_blocklog;
 		if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
-			return 1U << mp->m_writeio_log;
+			return 1U << mp->m_allocsize_log;
 	}
 
 	return PAGE_SIZE;
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 359fcfb494d4..1853797ea938 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -440,13 +440,13 @@ xfs_set_rw_sizes(xfs_mount_t *mp)
 	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE))
 		writeio_log = XFS_WRITEIO_LOG_LARGE;
 	else
-		writeio_log = mp->m_writeio_log;
+		writeio_log = mp->m_allocsize_log;
 
 	if (sbp->sb_blocklog > writeio_log)
-		mp->m_writeio_log = sbp->sb_blocklog;
+		mp->m_allocsize_log = sbp->sb_blocklog;
 	} else
-		mp->m_writeio_log = writeio_log;
-	mp->m_writeio_blocks = 1 << (mp->m_writeio_log - sbp->sb_blocklog);
+		mp->m_allocsize_log = writeio_log;
+	mp->m_allocsize_blocks = 1 << (mp->m_allocsize_log - sbp->sb_blocklog);
 }
 
 /*
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index fba818d5c540..109081c16a07 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -98,8 +98,8 @@ typedef struct xfs_mount {
 	xfs_agnumber_t		m_agirotor;	/* last ag dir inode alloced */
 	spinlock_t		m_agirotor_lock;/* .. and lock protecting it */
 	xfs_agnumber_t		m_maxagi;	/* highest inode alloc group */
-	uint			m_writeio_log;	/* min write size log bytes */
-	uint			m_writeio_blocks; /* min write size blocks */
+	uint			m_allocsize_log;/* min write size log bytes */
+	uint			m_allocsize_blocks; /* min write size blocks */
 	struct xfs_da_geometry	*m_dir_geo;	/* directory block geometry */
 	struct xfs_da_geometry	*m_attr_geo;	/* attribute block geometry */
 	struct xlog		*m_log;		/* log specific stuff */
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index a477348ab68b..d1a0958f336d 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -405,7 +405,7 @@ xfs_parseargs(
 		}
 
 		mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
-		mp->m_writeio_log = iosizelog;
+		mp->m_allocsize_log = iosizelog;
 	}
 
 	return 0;
@@ -456,7 +456,7 @@ xfs_showargs(
 
 	if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
 		seq_printf(m, ",allocsize=%dk",
-				(int)(1 << mp->m_writeio_log) >> 10);
+				(int)(1 << mp->m_allocsize_log) >> 10);
 
 	if (mp->m_logbufs > 0)
 		seq_printf(m, ",logbufs=%d", mp->m_logbufs);
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 926f4d10dc02..c13bb3655e48 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -725,7 +725,7 @@ TRACE_EVENT(xfs_iomap_prealloc_size,
 		__entry->writeio_blocks = writeio_blocks;
 	),
 	TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
-		  "m_writeio_blocks %u",
+		  "m_allocsize_blocks %u",
 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
 		  __entry->blocks, __entry->shift, __entry->writeio_blocks)
 )
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 07/12] xfs: simplify parsing of allocsize mount option
  2019-10-27 14:55 decruft misc mount related code v2 Christoph Hellwig
                   ` (5 preceding siblings ...)
  2019-10-27 14:55 ` [PATCH 06/12] xfs: rename the m_writeio_* " Christoph Hellwig
@ 2019-10-27 14:55 ` Christoph Hellwig
  2019-10-28 17:11   ` Darrick J. Wong
  2019-10-27 14:55 ` [PATCH 08/12] xfs: rename the XFS_MOUNT_DFLT_IOSIZE option to XFS_MOUNT_ALLOCISZE Christoph Hellwig
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-27 14:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Ian Kent

Rework xfs_parseargs to fill out the default value and then parse the
option directly into the mount structure, similar to what we do for
other updates, and open code the now trivial updates based on on the
on-disk superblock directly into xfs_mountfs.

Note that this change rejects the allocsize=0 mount option that has been
documented as invalid for a long time instead of just ignoring it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_mount.c | 31 +++++--------------------------
 fs/xfs/xfs_mount.h |  6 ------
 fs/xfs/xfs_super.c | 26 +++++++++++---------------
 3 files changed, 16 insertions(+), 47 deletions(-)

diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 1853797ea938..3e8eedf01eb2 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -425,30 +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		readio_log, writeio_log;
-
-	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE))
-		writeio_log = XFS_WRITEIO_LOG_LARGE;
-	else
-		writeio_log = mp->m_allocsize_log;
-
-	if (sbp->sb_blocklog > writeio_log)
-		mp->m_allocsize_log = sbp->sb_blocklog;
-	} else
-		mp->m_allocsize_log = writeio_log;
-	mp->m_allocsize_blocks = 1 << (mp->m_allocsize_log - sbp->sb_blocklog);
-}
-
 /*
  * precalculate the low space thresholds for dynamic speculative preallocation.
  */
@@ -713,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_allocsize_log =
+		max_t(uint32_t, sbp->sb_blocklog, mp->m_allocsize_log);
+	mp->m_allocsize_blocks = 1U << (mp->m_allocsize_log - sbp->sb_blocklog);
 
 	/* set the low space thresholds for dynamic preallocation */
 	xfs_set_low_space_thresholds(mp);
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 109081c16a07..712dbb2039cd 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -244,12 +244,6 @@ typedef struct xfs_mount {
 
 #define XFS_MOUNT_DAX		(1ULL << 62)	/* TEST ONLY! */
 
-
-/*
- * Default write size.
- */
-#define XFS_WRITEIO_LOG_LARGE	16
-
 /*
  * Max and min values for mount-option defined I/O
  * preallocation sizes.
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index d1a0958f336d..3e5002d2a79e 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -159,8 +159,7 @@ xfs_parseargs(
 	const struct super_block *sb = mp->m_super;
 	char			*p;
 	substring_t		args[MAX_OPT_ARGS];
-	int			iosize = 0;
-	uint8_t			iosizelog = 0;
+	int			size = 0;
 
 	/*
 	 * set up the mount name first so all the errors will refer to the
@@ -192,6 +191,7 @@ xfs_parseargs(
 	 */
 	mp->m_logbufs = -1;
 	mp->m_logbsize = -1;
+	mp->m_allocsize_log = 16; /* 64k */
 
 	if (!options)
 		goto done;
@@ -225,9 +225,10 @@ xfs_parseargs(
 				return -ENOMEM;
 			break;
 		case Opt_allocsize:
-			if (suffix_kstrtoint(args, 10, &iosize))
+			if (suffix_kstrtoint(args, 10, &size))
 				return -EINVAL;
-			iosizelog = ffs(iosize) - 1;
+			mp->m_allocsize_log = ffs(size) - 1;
+			mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
 			break;
 		case Opt_grpid:
 		case Opt_bsdgroups:
@@ -395,17 +396,12 @@ xfs_parseargs(
 		return -EINVAL;
 	}
 
-	if (iosizelog) {
-		if (iosizelog > XFS_MAX_IO_LOG ||
-		    iosizelog < XFS_MIN_IO_LOG) {
-			xfs_warn(mp, "invalid log iosize: %d [not %d-%d]",
-				iosizelog, XFS_MIN_IO_LOG,
-				XFS_MAX_IO_LOG);
-			return -EINVAL;
-		}
-
-		mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
-		mp->m_allocsize_log = iosizelog;
+	if ((mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) &&
+	    (mp->m_allocsize_log > XFS_MAX_IO_LOG ||
+	     mp->m_allocsize_log < XFS_MIN_IO_LOG)) {
+		xfs_warn(mp, "invalid log iosize: %d [not %d-%d]",
+			mp->m_allocsize_log, XFS_MIN_IO_LOG, XFS_MAX_IO_LOG);
+		return -EINVAL;
 	}
 
 	return 0;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 08/12] xfs: rename the XFS_MOUNT_DFLT_IOSIZE option to XFS_MOUNT_ALLOCISZE
  2019-10-27 14:55 decruft misc mount related code v2 Christoph Hellwig
                   ` (6 preceding siblings ...)
  2019-10-27 14:55 ` [PATCH 07/12] xfs: simplify parsing of allocsize mount option Christoph Hellwig
@ 2019-10-27 14:55 ` Christoph Hellwig
  2019-10-28 17:12   ` Darrick J. Wong
  2019-10-27 14:55 ` [PATCH 09/12] xfs: reverse the polarity of XFS_MOUNT_COMPAT_IOSIZE Christoph Hellwig
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-27 14:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Ian Kent

Make the flag match the mount option and usage.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_iomap.c | 4 ++--
 fs/xfs/xfs_iops.c  | 2 +-
 fs/xfs/xfs_mount.h | 2 +-
 fs/xfs/xfs_super.c | 6 +++---
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 64bd30a24a71..3c2098f1ded0 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -390,7 +390,7 @@ xfs_iomap_prealloc_size(
 	if (offset + count <= XFS_ISIZE(ip))
 		return 0;
 
-	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) &&
+	if (!(mp->m_flags & XFS_MOUNT_ALLOCSIZE) &&
 	    (XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_allocsize_blocks)))
 		return 0;
 
@@ -398,7 +398,7 @@ xfs_iomap_prealloc_size(
 	 * If an explicit allocsize is set, the file is small, or we
 	 * are writing behind a hole, then use the minimum prealloc:
 	 */
-	if ((mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) ||
+	if ((mp->m_flags & XFS_MOUNT_ALLOCSIZE) ||
 	    XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_dalign) ||
 	    !xfs_iext_peek_prev_extent(ifp, icur, &prev) ||
 	    prev.br_startoff + prev.br_blockcount < offset_fsb)
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 382d72769470..9e1f89cdcc82 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -513,7 +513,7 @@ xfs_stat_blksize(
 	if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE)) {
 		if (mp->m_swidth)
 			return mp->m_swidth << mp->m_sb.sb_blocklog;
-		if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
+		if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
 			return 1U << mp->m_allocsize_log;
 	}
 
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 712dbb2039cd..e5c364f1605e 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -227,7 +227,7 @@ typedef struct xfs_mount {
 #define XFS_MOUNT_ATTR2		(1ULL << 8)	/* allow use of attr2 format */
 #define XFS_MOUNT_GRPID		(1ULL << 9)	/* group-ID assigned from directory */
 #define XFS_MOUNT_NORECOVERY	(1ULL << 10)	/* no recovery - dirty fs */
-#define XFS_MOUNT_DFLT_IOSIZE	(1ULL << 12)	/* set default i/o size */
+#define XFS_MOUNT_ALLOCSIZE	(1ULL << 12)	/* specified allocation size */
 #define XFS_MOUNT_SMALL_INUMS	(1ULL << 14)	/* user wants 32bit inodes */
 #define XFS_MOUNT_32BITINODES	(1ULL << 15)	/* inode32 allocator active */
 #define XFS_MOUNT_NOUUID	(1ULL << 16)	/* ignore uuid during mount */
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 3e5002d2a79e..a7d89b87ed22 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -228,7 +228,7 @@ xfs_parseargs(
 			if (suffix_kstrtoint(args, 10, &size))
 				return -EINVAL;
 			mp->m_allocsize_log = ffs(size) - 1;
-			mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
+			mp->m_flags |= XFS_MOUNT_ALLOCSIZE;
 			break;
 		case Opt_grpid:
 		case Opt_bsdgroups:
@@ -396,7 +396,7 @@ xfs_parseargs(
 		return -EINVAL;
 	}
 
-	if ((mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) &&
+	if ((mp->m_flags & XFS_MOUNT_ALLOCSIZE) &&
 	    (mp->m_allocsize_log > XFS_MAX_IO_LOG ||
 	     mp->m_allocsize_log < XFS_MIN_IO_LOG)) {
 		xfs_warn(mp, "invalid log iosize: %d [not %d-%d]",
@@ -450,7 +450,7 @@ xfs_showargs(
 			seq_puts(m, xfs_infop->str);
 	}
 
-	if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
+	if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
 		seq_printf(m, ",allocsize=%dk",
 				(int)(1 << mp->m_allocsize_log) >> 10);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 09/12] xfs: reverse the polarity of XFS_MOUNT_COMPAT_IOSIZE
  2019-10-27 14:55 decruft misc mount related code v2 Christoph Hellwig
                   ` (7 preceding siblings ...)
  2019-10-27 14:55 ` [PATCH 08/12] xfs: rename the XFS_MOUNT_DFLT_IOSIZE option to XFS_MOUNT_ALLOCISZE Christoph Hellwig
@ 2019-10-27 14:55 ` Christoph Hellwig
  2019-10-28 17:13   ` Darrick J. Wong
  2019-10-27 14:55 ` [PATCH 10/12] xfs: clean up printing the allocsize option in xfs_showargs Christoph Hellwig
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-27 14:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Ian Kent, Eric Sandeen

Replace XFS_MOUNT_COMPAT_IOSIZE with an inverted XFS_MOUNT_LARGEIO flag
that makes the usage more clear.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
---
 fs/xfs/xfs_iops.c  |  2 +-
 fs/xfs/xfs_mount.h |  2 +-
 fs/xfs/xfs_super.c | 12 +++---------
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 9e1f89cdcc82..18e45e3a3f9f 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -510,7 +510,7 @@ xfs_stat_blksize(
 	 * default buffered I/O size, return that, otherwise return the compat
 	 * default.
 	 */
-	if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE)) {
+	if (mp->m_flags & XFS_MOUNT_LARGEIO) {
 		if (mp->m_swidth)
 			return mp->m_swidth << mp->m_sb.sb_blocklog;
 		if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index e5c364f1605e..a46cb3fd24b1 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -236,7 +236,7 @@ typedef struct xfs_mount {
 						 * allocation */
 #define XFS_MOUNT_RDONLY	(1ULL << 20)	/* read-only fs */
 #define XFS_MOUNT_DIRSYNC	(1ULL << 21)	/* synchronous directory ops */
-#define XFS_MOUNT_COMPAT_IOSIZE	(1ULL << 22)	/* don't report large preferred
+#define XFS_MOUNT_LARGEIO	(1ULL << 22)	/* report large preferred
 						 * I/O size in stat() */
 #define XFS_MOUNT_FILESTREAMS	(1ULL << 24)	/* enable the filestreams
 						   allocator */
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index a7d89b87ed22..f21c59822a38 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -180,12 +180,6 @@ xfs_parseargs(
 	if (sb->s_flags & SB_SYNCHRONOUS)
 		mp->m_flags |= XFS_MOUNT_WSYNC;
 
-	/*
-	 * Set some default flags that could be cleared by the mount option
-	 * parsing.
-	 */
-	mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;
-
 	/*
 	 * These can be overridden by the mount option parsing.
 	 */
@@ -274,10 +268,10 @@ xfs_parseargs(
 			mp->m_flags &= ~XFS_MOUNT_IKEEP;
 			break;
 		case Opt_largeio:
-			mp->m_flags &= ~XFS_MOUNT_COMPAT_IOSIZE;
+			mp->m_flags |= XFS_MOUNT_LARGEIO;
 			break;
 		case Opt_nolargeio:
-			mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;
+			mp->m_flags &= ~XFS_MOUNT_LARGEIO;
 			break;
 		case Opt_attr2:
 			mp->m_flags |= XFS_MOUNT_ATTR2;
@@ -430,12 +424,12 @@ xfs_showargs(
 		{ XFS_MOUNT_GRPID,		",grpid" },
 		{ XFS_MOUNT_DISCARD,		",discard" },
 		{ XFS_MOUNT_SMALL_INUMS,	",inode32" },
+		{ XFS_MOUNT_LARGEIO,		",largeio" },
 		{ XFS_MOUNT_DAX,		",dax" },
 		{ 0, NULL }
 	};
 	static struct proc_xfs_info xfs_info_unset[] = {
 		/* the few simple ones we can get from the mount struct */
-		{ XFS_MOUNT_COMPAT_IOSIZE,	",largeio" },
 		{ XFS_MOUNT_SMALL_INUMS,	",inode64" },
 		{ 0, NULL }
 	};
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/12] xfs: clean up printing the allocsize option in xfs_showargs
  2019-10-27 14:55 decruft misc mount related code v2 Christoph Hellwig
                   ` (8 preceding siblings ...)
  2019-10-27 14:55 ` [PATCH 09/12] xfs: reverse the polarity of XFS_MOUNT_COMPAT_IOSIZE Christoph Hellwig
@ 2019-10-27 14:55 ` Christoph Hellwig
  2019-10-28 17:13   ` Darrick J. Wong
  2019-10-27 14:55 ` [PATCH 11/12] xfs: clean up printing inode32/64 " Christoph Hellwig
  2019-10-27 14:55 ` [PATCH 12/12] xfs: merge xfs_showargs into xfs_fs_show_options Christoph Hellwig
  11 siblings, 1 reply; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-27 14:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Ian Kent

Remove superflous cast.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index f21c59822a38..93ed0871b1cf 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -446,7 +446,7 @@ xfs_showargs(
 
 	if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
 		seq_printf(m, ",allocsize=%dk",
-				(int)(1 << mp->m_allocsize_log) >> 10);
+			   (1 << mp->m_allocsize_log) >> 10);
 
 	if (mp->m_logbufs > 0)
 		seq_printf(m, ",logbufs=%d", mp->m_logbufs);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 11/12] xfs: clean up printing inode32/64 in xfs_showargs
  2019-10-27 14:55 decruft misc mount related code v2 Christoph Hellwig
                   ` (9 preceding siblings ...)
  2019-10-27 14:55 ` [PATCH 10/12] xfs: clean up printing the allocsize option in xfs_showargs Christoph Hellwig
@ 2019-10-27 14:55 ` Christoph Hellwig
  2019-10-28 17:14   ` Darrick J. Wong
  2019-10-27 14:55 ` [PATCH 12/12] xfs: merge xfs_showargs into xfs_fs_show_options Christoph Hellwig
  11 siblings, 1 reply; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-27 14:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Ian Kent

inode64 is the only value remaining in the unset array.  Special case
the inode32/64 options with an explicit seq_printf that prints either
inode32 or inode64, and remove the unset array.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_super.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 93ed0871b1cf..0e8942bbf840 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -423,26 +423,19 @@ xfs_showargs(
 		{ XFS_MOUNT_FILESTREAMS,	",filestreams" },
 		{ XFS_MOUNT_GRPID,		",grpid" },
 		{ XFS_MOUNT_DISCARD,		",discard" },
-		{ XFS_MOUNT_SMALL_INUMS,	",inode32" },
 		{ XFS_MOUNT_LARGEIO,		",largeio" },
 		{ XFS_MOUNT_DAX,		",dax" },
 		{ 0, NULL }
 	};
-	static struct proc_xfs_info xfs_info_unset[] = {
-		/* the few simple ones we can get from the mount struct */
-		{ XFS_MOUNT_SMALL_INUMS,	",inode64" },
-		{ 0, NULL }
-	};
 	struct proc_xfs_info	*xfs_infop;
 
 	for (xfs_infop = xfs_info_set; xfs_infop->flag; xfs_infop++) {
 		if (mp->m_flags & xfs_infop->flag)
 			seq_puts(m, xfs_infop->str);
 	}
-	for (xfs_infop = xfs_info_unset; xfs_infop->flag; xfs_infop++) {
-		if (!(mp->m_flags & xfs_infop->flag))
-			seq_puts(m, xfs_infop->str);
-	}
+
+	seq_printf(m, ",inode%d",
+		(mp->m_flags & XFS_MOUNT_SMALL_INUMS) ? 32 : 64);
 
 	if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
 		seq_printf(m, ",allocsize=%dk",
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 12/12] xfs: merge xfs_showargs into xfs_fs_show_options
  2019-10-27 14:55 decruft misc mount related code v2 Christoph Hellwig
                   ` (10 preceding siblings ...)
  2019-10-27 14:55 ` [PATCH 11/12] xfs: clean up printing inode32/64 " Christoph Hellwig
@ 2019-10-27 14:55 ` Christoph Hellwig
  2019-10-28 17:14   ` Darrick J. Wong
  11 siblings, 1 reply; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-27 14:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Ian Kent

No need for a trivial wrapper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_super.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 0e8942bbf840..bcb1575a5652 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -406,10 +406,10 @@ struct proc_xfs_info {
 	char		*str;
 };
 
-STATIC void
-xfs_showargs(
-	struct xfs_mount	*mp,
-	struct seq_file		*m)
+static int
+xfs_fs_show_options(
+	struct seq_file		*m,
+	struct dentry		*root)
 {
 	static struct proc_xfs_info xfs_info_set[] = {
 		/* the few simple ones we can get from the mount struct */
@@ -427,6 +427,7 @@ xfs_showargs(
 		{ XFS_MOUNT_DAX,		",dax" },
 		{ 0, NULL }
 	};
+	struct xfs_mount	*mp = XFS_M(root->d_sb);
 	struct proc_xfs_info	*xfs_infop;
 
 	for (xfs_infop = xfs_info_set; xfs_infop->flag; xfs_infop++) {
@@ -478,6 +479,8 @@ xfs_showargs(
 
 	if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT))
 		seq_puts(m, ",noquota");
+
+	return 0;
 }
 
 static uint64_t
@@ -1378,15 +1381,6 @@ xfs_fs_unfreeze(
 	return 0;
 }
 
-STATIC int
-xfs_fs_show_options(
-	struct seq_file		*m,
-	struct dentry		*root)
-{
-	xfs_showargs(XFS_M(root->d_sb), m);
-	return 0;
-}
-
 /*
  * This function fills in xfs_mount_t fields based on mount args.
  * Note: the superblock _has_ now been read in.
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 03/12] xfs: cleanup calculating the stat optimal I/O size
  2019-10-27 14:55 ` [PATCH 03/12] xfs: cleanup calculating the stat optimal I/O size Christoph Hellwig
@ 2019-10-28 16:50   ` Darrick J. Wong
  0 siblings, 0 replies; 25+ messages in thread
From: Darrick J. Wong @ 2019-10-28 16:50 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, Ian Kent, Eric Sandeen

On Sun, Oct 27, 2019 at 03:55:38PM +0100, Christoph Hellwig wrote:
> Move xfs_preferred_iosize to xfs_iops.c, unobsfucate it and also handle
> the realtime special case in the helper.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_iops.c  | 47 ++++++++++++++++++++++++++++++++++++----------
>  fs/xfs/xfs_mount.h | 24 -----------------------
>  2 files changed, 37 insertions(+), 34 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 404f2dd58698..b6dbfd8eb6a1 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -484,6 +484,42 @@ xfs_vn_get_link_inline(
>  	return link;
>  }
>  
> +static uint32_t
> +xfs_stat_blksize(
> +	struct xfs_inode	*ip)
> +{
> +	struct xfs_mount	*mp = ip->i_mount;
> +
> +	/*
> +	 * If the file blocks are being allocated from a realtime volume, then
> +	 * always return the realtime extent size.
> +	 */
> +	if (XFS_IS_REALTIME_INODE(ip))
> +		return xfs_get_extsz_hint(ip) << mp->m_sb.sb_blocklog;
> +
> +	/*
> +	 * Allow large block sizes to be reported to userspace programs if the
> +	 * "largeio" mount option is used.
> +	 *
> +	 * If compatibility mode is specified, simply return the basic unit of
> +	 * caching so that we don't get inefficient read/modify/write I/O from
> +	 * user apps. Otherwise....
> +	 *
> +	 * If the underlying volume is a stripe, then return the stripe width in
> +	 * bytes as the recommended I/O size. It is not a stripe and we've set a
> +	 * default buffered I/O size, return that, otherwise return the compat
> +	 * default.
> +	 */
> +	if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE)) {
> +		if (mp->m_swidth)
> +			return mp->m_swidth << mp->m_sb.sb_blocklog;
> +		if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
> +			return 1U << max(mp->m_readio_log, mp->m_writeio_log);
> +	}
> +
> +	return PAGE_SIZE;
> +}
> +
>  STATIC int
>  xfs_vn_getattr(
>  	const struct path	*path,
> @@ -543,16 +579,7 @@ xfs_vn_getattr(
>  		stat->rdev = inode->i_rdev;
>  		break;
>  	default:
> -		if (XFS_IS_REALTIME_INODE(ip)) {
> -			/*
> -			 * If the file blocks are being allocated from a
> -			 * realtime volume, then return the inode's realtime
> -			 * extent size or the realtime volume's extent size.
> -			 */
> -			stat->blksize =
> -				xfs_get_extsz_hint(ip) << mp->m_sb.sb_blocklog;
> -		} else
> -			stat->blksize = xfs_preferred_iosize(mp);
> +		stat->blksize = xfs_stat_blksize(ip);
>  		stat->rdev = 0;
>  		break;
>  	}
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index fdb60e09a9c5..f69e370db341 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -267,30 +267,6 @@ typedef struct xfs_mount {
>  #define	XFS_WSYNC_READIO_LOG	15	/* 32k */
>  #define	XFS_WSYNC_WRITEIO_LOG	14	/* 16k */
>  
> -/*
> - * Allow large block sizes to be reported to userspace programs if the
> - * "largeio" mount option is used.
> - *
> - * If compatibility mode is specified, simply return the basic unit of caching
> - * so that we don't get inefficient read/modify/write I/O from user apps.
> - * Otherwise....
> - *
> - * If the underlying volume is a stripe, then return the stripe width in bytes
> - * as the recommended I/O size. It is not a stripe and we've set a default
> - * buffered I/O size, return that, otherwise return the compat default.
> - */
> -static inline unsigned long
> -xfs_preferred_iosize(xfs_mount_t *mp)
> -{
> -	if (mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE)
> -		return PAGE_SIZE;
> -	return (mp->m_swidth ?
> -		(mp->m_swidth << mp->m_sb.sb_blocklog) :
> -		((mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) ?
> -			(1 << (int)max(mp->m_readio_log, mp->m_writeio_log)) :
> -			PAGE_SIZE));
> -}
> -
>  #define XFS_LAST_UNMOUNT_WAS_CLEAN(mp)	\
>  				((mp)->m_flags & XFS_MOUNT_WAS_CLEAN)
>  #define XFS_FORCED_SHUTDOWN(mp)	((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN)
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 02/12] xfs: remove the dsunit and dswidth variables in xfs_parseargs
  2019-10-27 14:55 ` [PATCH 02/12] xfs: remove the dsunit and dswidth variables in xfs_parseargs Christoph Hellwig
@ 2019-10-28 16:50   ` Darrick J. Wong
  0 siblings, 0 replies; 25+ messages in thread
From: Darrick J. Wong @ 2019-10-28 16:50 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, Ian Kent, Eric Sandeen

On Sun, Oct 27, 2019 at 03:55:37PM +0100, Christoph Hellwig wrote:
> There is no real need for the local variables here - either they
> are applied to the mount structure, or if the noalign mount option
> is set the mount will fail entirely if either is set.  Removing
> them helps cleaning up the mount API conversion.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_super.c | 27 ++++++++-------------------
>  1 file changed, 8 insertions(+), 19 deletions(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 589c080cabfe..4089de3daded 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -159,8 +159,6 @@ xfs_parseargs(
>  	const struct super_block *sb = mp->m_super;
>  	char			*p;
>  	substring_t		args[MAX_OPT_ARGS];
> -	int			dsunit = 0;
> -	int			dswidth = 0;
>  	int			iosize = 0;
>  	uint8_t			iosizelog = 0;
>  
> @@ -252,11 +250,11 @@ xfs_parseargs(
>  			mp->m_flags |= XFS_MOUNT_SWALLOC;
>  			break;
>  		case Opt_sunit:
> -			if (match_int(args, &dsunit))
> +			if (match_int(args, &mp->m_dalign))
>  				return -EINVAL;
>  			break;
>  		case Opt_swidth:
> -			if (match_int(args, &dswidth))
> +			if (match_int(args, &mp->m_swidth))
>  				return -EINVAL;
>  			break;
>  		case Opt_inode32:
> @@ -350,7 +348,8 @@ xfs_parseargs(
>  		return -EINVAL;
>  	}
>  
> -	if ((mp->m_flags & XFS_MOUNT_NOALIGN) && (dsunit || dswidth)) {
> +	if ((mp->m_flags & XFS_MOUNT_NOALIGN) &&
> +	    (mp->m_dalign || mp->m_swidth)) {
>  		xfs_warn(mp,
>  	"sunit and swidth options incompatible with the noalign option");
>  		return -EINVAL;
> @@ -363,30 +362,20 @@ xfs_parseargs(
>  	}
>  #endif
>  
> -	if ((dsunit && !dswidth) || (!dsunit && dswidth)) {
> +	if ((mp->m_dalign && !mp->m_swidth) ||
> +	    (!mp->m_dalign && mp->m_swidth)) {
>  		xfs_warn(mp, "sunit and swidth must be specified together");
>  		return -EINVAL;
>  	}
>  
> -	if (dsunit && (dswidth % dsunit != 0)) {
> +	if (mp->m_dalign && (mp->m_swidth % mp->m_dalign != 0)) {
>  		xfs_warn(mp,
>  	"stripe width (%d) must be a multiple of the stripe unit (%d)",
> -			dswidth, dsunit);
> +			mp->m_swidth, mp->m_dalign);
>  		return -EINVAL;
>  	}
>  
>  done:
> -	if (dsunit && !(mp->m_flags & XFS_MOUNT_NOALIGN)) {
> -		/*
> -		 * At this point the superblock has not been read
> -		 * in, therefore we do not know the block size.
> -		 * Before the mount call ends we will convert
> -		 * these to FSBs.
> -		 */
> -		mp->m_dalign = dsunit;
> -		mp->m_swidth = dswidth;
> -	}
> -
>  	if (mp->m_logbufs != -1 &&
>  	    mp->m_logbufs != 0 &&
>  	    (mp->m_logbufs < XLOG_MIN_ICLOGS ||
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 04/12] xfs: don't use a different allocsice for -o wsync mounts
  2019-10-27 14:55 ` [PATCH 04/12] xfs: don't use a different allocsice for -o wsync mounts Christoph Hellwig
@ 2019-10-28 17:05   ` Darrick J. Wong
  0 siblings, 0 replies; 25+ messages in thread
From: Darrick J. Wong @ 2019-10-28 17:05 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, Ian Kent

On Sun, Oct 27, 2019 at 03:55:39PM +0100, Christoph Hellwig wrote:
> The -o wsync allocsize overwrite overwrite was part of a special hack
> for NFSv2 servers in IRIX and has no real purpose in modern Linux, so
> remove it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

/me not being around to absorb any of the context of how the 15/16
shift values were arrived at notwithstanding,

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_mount.c | 9 ++-------
>  fs/xfs/xfs_mount.h | 7 -------
>  2 files changed, 2 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index ba5b6f3b2b88..b423033e14f4 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -438,13 +438,8 @@ xfs_set_rw_sizes(xfs_mount_t *mp)
>  	int		readio_log, writeio_log;
>  
>  	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)) {
> -		if (mp->m_flags & XFS_MOUNT_WSYNC) {
> -			readio_log = XFS_WSYNC_READIO_LOG;
> -			writeio_log = XFS_WSYNC_WRITEIO_LOG;
> -		} else {
> -			readio_log = XFS_READIO_LOG_LARGE;
> -			writeio_log = XFS_WRITEIO_LOG_LARGE;
> -		}
> +		readio_log = XFS_READIO_LOG_LARGE;
> +		writeio_log = XFS_WRITEIO_LOG_LARGE;
>  	} else {
>  		readio_log = mp->m_readio_log;
>  		writeio_log = mp->m_writeio_log;
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index f69e370db341..dc81e5c264ce 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -260,13 +260,6 @@ typedef struct xfs_mount {
>  #define XFS_MAX_IO_LOG		30	/* 1G */
>  #define XFS_MIN_IO_LOG		PAGE_SHIFT
>  
> -/*
> - * Synchronous read and write sizes.  This should be
> - * better for NFSv2 wsync filesystems.
> - */
> -#define	XFS_WSYNC_READIO_LOG	15	/* 32k */
> -#define	XFS_WSYNC_WRITEIO_LOG	14	/* 16k */
> -
>  #define XFS_LAST_UNMOUNT_WAS_CLEAN(mp)	\
>  				((mp)->m_flags & XFS_MOUNT_WAS_CLEAN)
>  #define XFS_FORCED_SHUTDOWN(mp)	((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN)
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 05/12] xfs: remove the m_readio_* fields in struct xfs_mount
  2019-10-27 14:55 ` [PATCH 05/12] xfs: remove the m_readio_* fields in struct xfs_mount Christoph Hellwig
@ 2019-10-28 17:06   ` Darrick J. Wong
  0 siblings, 0 replies; 25+ messages in thread
From: Darrick J. Wong @ 2019-10-28 17:06 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, Ian Kent

On Sun, Oct 27, 2019 at 03:55:40PM +0100, Christoph Hellwig wrote:
> m_readio_blocks is entirely unused, and m_readio_blocks is only used in
> xfs_stat_blksize in a max statements that is a no-op as it always has
> the same value as m_writeio_log.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_iops.c  |  2 +-
>  fs/xfs/xfs_mount.c | 18 ++++--------------
>  fs/xfs/xfs_mount.h |  5 +----
>  fs/xfs/xfs_super.c |  1 -
>  4 files changed, 6 insertions(+), 20 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index b6dbfd8eb6a1..271fcbe04d48 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -514,7 +514,7 @@ xfs_stat_blksize(
>  		if (mp->m_swidth)
>  			return mp->m_swidth << mp->m_sb.sb_blocklog;
>  		if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
> -			return 1U << max(mp->m_readio_log, mp->m_writeio_log);
> +			return 1U << mp->m_writeio_log;
>  	}
>  
>  	return PAGE_SIZE;
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index b423033e14f4..359fcfb494d4 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -437,25 +437,15 @@ xfs_set_rw_sizes(xfs_mount_t *mp)
>  	xfs_sb_t	*sbp = &(mp->m_sb);
>  	int		readio_log, writeio_log;
>  
> -	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)) {
> -		readio_log = XFS_READIO_LOG_LARGE;
> +	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE))
>  		writeio_log = XFS_WRITEIO_LOG_LARGE;
> -	} else {
> -		readio_log = mp->m_readio_log;
> +	else
>  		writeio_log = mp->m_writeio_log;
> -	}
>  
> -	if (sbp->sb_blocklog > readio_log) {
> -		mp->m_readio_log = sbp->sb_blocklog;
> -	} else {
> -		mp->m_readio_log = readio_log;
> -	}
> -	mp->m_readio_blocks = 1 << (mp->m_readio_log - sbp->sb_blocklog);
> -	if (sbp->sb_blocklog > writeio_log) {
> +	if (sbp->sb_blocklog > writeio_log)
>  		mp->m_writeio_log = sbp->sb_blocklog;
> -	} else {
> +	} else
>  		mp->m_writeio_log = writeio_log;
> -	}
>  	mp->m_writeio_blocks = 1 << (mp->m_writeio_log - sbp->sb_blocklog);
>  }
>  
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index dc81e5c264ce..fba818d5c540 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -98,8 +98,6 @@ typedef struct xfs_mount {
>  	xfs_agnumber_t		m_agirotor;	/* last ag dir inode alloced */
>  	spinlock_t		m_agirotor_lock;/* .. and lock protecting it */
>  	xfs_agnumber_t		m_maxagi;	/* highest inode alloc group */
> -	uint			m_readio_log;	/* min read size log bytes */
> -	uint			m_readio_blocks; /* min read size blocks */
>  	uint			m_writeio_log;	/* min write size log bytes */
>  	uint			m_writeio_blocks; /* min write size blocks */
>  	struct xfs_da_geometry	*m_dir_geo;	/* directory block geometry */
> @@ -248,9 +246,8 @@ typedef struct xfs_mount {
>  
>  
>  /*
> - * Default minimum read and write sizes.
> + * Default write size.
>   */
> -#define XFS_READIO_LOG_LARGE	16
>  #define XFS_WRITEIO_LOG_LARGE	16
>  
>  /*
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 4089de3daded..a477348ab68b 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -405,7 +405,6 @@ xfs_parseargs(
>  		}
>  
>  		mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
> -		mp->m_readio_log = iosizelog;
>  		mp->m_writeio_log = iosizelog;
>  	}
>  
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 06/12] xfs: rename the m_writeio_* fields in struct xfs_mount
  2019-10-27 14:55 ` [PATCH 06/12] xfs: rename the m_writeio_* " Christoph Hellwig
@ 2019-10-28 17:07   ` Darrick J. Wong
  0 siblings, 0 replies; 25+ messages in thread
From: Darrick J. Wong @ 2019-10-28 17:07 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, Ian Kent

On Sun, Oct 27, 2019 at 03:55:41PM +0100, Christoph Hellwig wrote:
> Use the allocsize name to match the mount option and usage instead.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_iomap.c | 16 ++++++++--------
>  fs/xfs/xfs_iops.c  |  2 +-
>  fs/xfs/xfs_mount.c |  8 ++++----
>  fs/xfs/xfs_mount.h |  4 ++--
>  fs/xfs/xfs_super.c |  4 ++--
>  fs/xfs/xfs_trace.h |  2 +-
>  6 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
> index 4af50b101d2b..64bd30a24a71 100644
> --- a/fs/xfs/xfs_iomap.c
> +++ b/fs/xfs/xfs_iomap.c
> @@ -29,8 +29,8 @@
>  #include "xfs_reflink.h"
>  
>  
> -#define XFS_WRITEIO_ALIGN(mp,off)	(((off) >> mp->m_writeio_log) \
> -						<< mp->m_writeio_log)
> +#define XFS_ALLOC_ALIGN(mp, off) \
> +	(((off) >> mp->m_allocsize_log) << mp->m_allocsize_log)
>  
>  static int
>  xfs_alert_fsblock_zero(
> @@ -391,7 +391,7 @@ xfs_iomap_prealloc_size(
>  		return 0;
>  
>  	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) &&
> -	    (XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_writeio_blocks)))
> +	    (XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_allocsize_blocks)))
>  		return 0;
>  
>  	/*
> @@ -402,7 +402,7 @@ xfs_iomap_prealloc_size(
>  	    XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_dalign) ||
>  	    !xfs_iext_peek_prev_extent(ifp, icur, &prev) ||
>  	    prev.br_startoff + prev.br_blockcount < offset_fsb)
> -		return mp->m_writeio_blocks;
> +		return mp->m_allocsize_blocks;
>  
>  	/*
>  	 * Determine the initial size of the preallocation. We are beyond the
> @@ -495,10 +495,10 @@ xfs_iomap_prealloc_size(
>  	while (alloc_blocks && alloc_blocks >= freesp)
>  		alloc_blocks >>= 4;
>  check_writeio:
> -	if (alloc_blocks < mp->m_writeio_blocks)
> -		alloc_blocks = mp->m_writeio_blocks;
> +	if (alloc_blocks < mp->m_allocsize_blocks)
> +		alloc_blocks = mp->m_allocsize_blocks;
>  	trace_xfs_iomap_prealloc_size(ip, alloc_blocks, shift,
> -				      mp->m_writeio_blocks);
> +				      mp->m_allocsize_blocks);
>  	return alloc_blocks;
>  }
>  
> @@ -962,7 +962,7 @@ xfs_buffered_write_iomap_begin(
>  			xfs_off_t	end_offset;
>  			xfs_fileoff_t	p_end_fsb;
>  
> -			end_offset = XFS_WRITEIO_ALIGN(mp, offset + count - 1);
> +			end_offset = XFS_ALLOC_ALIGN(mp, offset + count - 1);
>  			p_end_fsb = XFS_B_TO_FSBT(mp, end_offset) +
>  					prealloc_blocks;
>  
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 271fcbe04d48..382d72769470 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -514,7 +514,7 @@ xfs_stat_blksize(
>  		if (mp->m_swidth)
>  			return mp->m_swidth << mp->m_sb.sb_blocklog;
>  		if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
> -			return 1U << mp->m_writeio_log;
> +			return 1U << mp->m_allocsize_log;
>  	}
>  
>  	return PAGE_SIZE;
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 359fcfb494d4..1853797ea938 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -440,13 +440,13 @@ xfs_set_rw_sizes(xfs_mount_t *mp)
>  	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE))
>  		writeio_log = XFS_WRITEIO_LOG_LARGE;
>  	else
> -		writeio_log = mp->m_writeio_log;
> +		writeio_log = mp->m_allocsize_log;
>  
>  	if (sbp->sb_blocklog > writeio_log)
> -		mp->m_writeio_log = sbp->sb_blocklog;
> +		mp->m_allocsize_log = sbp->sb_blocklog;
>  	} else
> -		mp->m_writeio_log = writeio_log;
> -	mp->m_writeio_blocks = 1 << (mp->m_writeio_log - sbp->sb_blocklog);
> +		mp->m_allocsize_log = writeio_log;
> +	mp->m_allocsize_blocks = 1 << (mp->m_allocsize_log - sbp->sb_blocklog);
>  }
>  
>  /*
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index fba818d5c540..109081c16a07 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -98,8 +98,8 @@ typedef struct xfs_mount {
>  	xfs_agnumber_t		m_agirotor;	/* last ag dir inode alloced */
>  	spinlock_t		m_agirotor_lock;/* .. and lock protecting it */
>  	xfs_agnumber_t		m_maxagi;	/* highest inode alloc group */
> -	uint			m_writeio_log;	/* min write size log bytes */
> -	uint			m_writeio_blocks; /* min write size blocks */
> +	uint			m_allocsize_log;/* min write size log bytes */
> +	uint			m_allocsize_blocks; /* min write size blocks */
>  	struct xfs_da_geometry	*m_dir_geo;	/* directory block geometry */
>  	struct xfs_da_geometry	*m_attr_geo;	/* attribute block geometry */
>  	struct xlog		*m_log;		/* log specific stuff */
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index a477348ab68b..d1a0958f336d 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -405,7 +405,7 @@ xfs_parseargs(
>  		}
>  
>  		mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
> -		mp->m_writeio_log = iosizelog;
> +		mp->m_allocsize_log = iosizelog;
>  	}
>  
>  	return 0;
> @@ -456,7 +456,7 @@ xfs_showargs(
>  
>  	if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
>  		seq_printf(m, ",allocsize=%dk",
> -				(int)(1 << mp->m_writeio_log) >> 10);
> +				(int)(1 << mp->m_allocsize_log) >> 10);
>  
>  	if (mp->m_logbufs > 0)
>  		seq_printf(m, ",logbufs=%d", mp->m_logbufs);
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index 926f4d10dc02..c13bb3655e48 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -725,7 +725,7 @@ TRACE_EVENT(xfs_iomap_prealloc_size,
>  		__entry->writeio_blocks = writeio_blocks;
>  	),
>  	TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
> -		  "m_writeio_blocks %u",
> +		  "m_allocsize_blocks %u",
>  		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
>  		  __entry->blocks, __entry->shift, __entry->writeio_blocks)
>  )
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 07/12] xfs: simplify parsing of allocsize mount option
  2019-10-27 14:55 ` [PATCH 07/12] xfs: simplify parsing of allocsize mount option Christoph Hellwig
@ 2019-10-28 17:11   ` Darrick J. Wong
  0 siblings, 0 replies; 25+ messages in thread
From: Darrick J. Wong @ 2019-10-28 17:11 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, Ian Kent

On Sun, Oct 27, 2019 at 03:55:42PM +0100, Christoph Hellwig wrote:
> Rework xfs_parseargs to fill out the default value and then parse the
> option directly into the mount structure, similar to what we do for
> other updates, and open code the now trivial updates based on on the
> on-disk superblock directly into xfs_mountfs.
> 
> Note that this change rejects the allocsize=0 mount option that has been
> documented as invalid for a long time instead of just ignoring it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_mount.c | 31 +++++--------------------------
>  fs/xfs/xfs_mount.h |  6 ------
>  fs/xfs/xfs_super.c | 26 +++++++++++---------------
>  3 files changed, 16 insertions(+), 47 deletions(-)
> 
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 1853797ea938..3e8eedf01eb2 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -425,30 +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		readio_log, writeio_log;
> -
> -	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE))
> -		writeio_log = XFS_WRITEIO_LOG_LARGE;
> -	else
> -		writeio_log = mp->m_allocsize_log;
> -
> -	if (sbp->sb_blocklog > writeio_log)
> -		mp->m_allocsize_log = sbp->sb_blocklog;
> -	} else
> -		mp->m_allocsize_log = writeio_log;
> -	mp->m_allocsize_blocks = 1 << (mp->m_allocsize_log - sbp->sb_blocklog);
> -}
> -
>  /*
>   * precalculate the low space thresholds for dynamic speculative preallocation.
>   */
> @@ -713,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_allocsize_log =
> +		max_t(uint32_t, sbp->sb_blocklog, mp->m_allocsize_log);
> +	mp->m_allocsize_blocks = 1U << (mp->m_allocsize_log - sbp->sb_blocklog);
>  
>  	/* set the low space thresholds for dynamic preallocation */
>  	xfs_set_low_space_thresholds(mp);
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index 109081c16a07..712dbb2039cd 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -244,12 +244,6 @@ typedef struct xfs_mount {
>  
>  #define XFS_MOUNT_DAX		(1ULL << 62)	/* TEST ONLY! */
>  
> -
> -/*
> - * Default write size.
> - */
> -#define XFS_WRITEIO_LOG_LARGE	16
> -
>  /*
>   * Max and min values for mount-option defined I/O
>   * preallocation sizes.
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index d1a0958f336d..3e5002d2a79e 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -159,8 +159,7 @@ xfs_parseargs(
>  	const struct super_block *sb = mp->m_super;
>  	char			*p;
>  	substring_t		args[MAX_OPT_ARGS];
> -	int			iosize = 0;
> -	uint8_t			iosizelog = 0;
> +	int			size = 0;
>  
>  	/*
>  	 * set up the mount name first so all the errors will refer to the
> @@ -192,6 +191,7 @@ xfs_parseargs(
>  	 */
>  	mp->m_logbufs = -1;
>  	mp->m_logbsize = -1;
> +	mp->m_allocsize_log = 16; /* 64k */
>  
>  	if (!options)
>  		goto done;
> @@ -225,9 +225,10 @@ xfs_parseargs(
>  				return -ENOMEM;
>  			break;
>  		case Opt_allocsize:
> -			if (suffix_kstrtoint(args, 10, &iosize))
> +			if (suffix_kstrtoint(args, 10, &size))
>  				return -EINVAL;
> -			iosizelog = ffs(iosize) - 1;
> +			mp->m_allocsize_log = ffs(size) - 1;
> +			mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
>  			break;
>  		case Opt_grpid:
>  		case Opt_bsdgroups:
> @@ -395,17 +396,12 @@ xfs_parseargs(
>  		return -EINVAL;
>  	}
>  
> -	if (iosizelog) {
> -		if (iosizelog > XFS_MAX_IO_LOG ||
> -		    iosizelog < XFS_MIN_IO_LOG) {
> -			xfs_warn(mp, "invalid log iosize: %d [not %d-%d]",
> -				iosizelog, XFS_MIN_IO_LOG,
> -				XFS_MAX_IO_LOG);
> -			return -EINVAL;
> -		}
> -
> -		mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
> -		mp->m_allocsize_log = iosizelog;
> +	if ((mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) &&
> +	    (mp->m_allocsize_log > XFS_MAX_IO_LOG ||
> +	     mp->m_allocsize_log < XFS_MIN_IO_LOG)) {
> +		xfs_warn(mp, "invalid log iosize: %d [not %d-%d]",
> +			mp->m_allocsize_log, XFS_MIN_IO_LOG, XFS_MAX_IO_LOG);
> +		return -EINVAL;
>  	}
>  
>  	return 0;
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 08/12] xfs: rename the XFS_MOUNT_DFLT_IOSIZE option to XFS_MOUNT_ALLOCISZE
  2019-10-27 14:55 ` [PATCH 08/12] xfs: rename the XFS_MOUNT_DFLT_IOSIZE option to XFS_MOUNT_ALLOCISZE Christoph Hellwig
@ 2019-10-28 17:12   ` Darrick J. Wong
  2019-10-29  7:50     ` Christoph Hellwig
  0 siblings, 1 reply; 25+ messages in thread
From: Darrick J. Wong @ 2019-10-28 17:12 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, Ian Kent

s/ALLOCISZE/ALLOCSIZE/ in the subject

On Sun, Oct 27, 2019 at 03:55:43PM +0100, Christoph Hellwig wrote:
> Make the flag match the mount option and usage.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

With that fixed,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_iomap.c | 4 ++--
>  fs/xfs/xfs_iops.c  | 2 +-
>  fs/xfs/xfs_mount.h | 2 +-
>  fs/xfs/xfs_super.c | 6 +++---
>  4 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
> index 64bd30a24a71..3c2098f1ded0 100644
> --- a/fs/xfs/xfs_iomap.c
> +++ b/fs/xfs/xfs_iomap.c
> @@ -390,7 +390,7 @@ xfs_iomap_prealloc_size(
>  	if (offset + count <= XFS_ISIZE(ip))
>  		return 0;
>  
> -	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) &&
> +	if (!(mp->m_flags & XFS_MOUNT_ALLOCSIZE) &&
>  	    (XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_allocsize_blocks)))
>  		return 0;
>  
> @@ -398,7 +398,7 @@ xfs_iomap_prealloc_size(
>  	 * If an explicit allocsize is set, the file is small, or we
>  	 * are writing behind a hole, then use the minimum prealloc:
>  	 */
> -	if ((mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) ||
> +	if ((mp->m_flags & XFS_MOUNT_ALLOCSIZE) ||
>  	    XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_dalign) ||
>  	    !xfs_iext_peek_prev_extent(ifp, icur, &prev) ||
>  	    prev.br_startoff + prev.br_blockcount < offset_fsb)
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 382d72769470..9e1f89cdcc82 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -513,7 +513,7 @@ xfs_stat_blksize(
>  	if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE)) {
>  		if (mp->m_swidth)
>  			return mp->m_swidth << mp->m_sb.sb_blocklog;
> -		if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
> +		if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
>  			return 1U << mp->m_allocsize_log;
>  	}
>  
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index 712dbb2039cd..e5c364f1605e 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -227,7 +227,7 @@ typedef struct xfs_mount {
>  #define XFS_MOUNT_ATTR2		(1ULL << 8)	/* allow use of attr2 format */
>  #define XFS_MOUNT_GRPID		(1ULL << 9)	/* group-ID assigned from directory */
>  #define XFS_MOUNT_NORECOVERY	(1ULL << 10)	/* no recovery - dirty fs */
> -#define XFS_MOUNT_DFLT_IOSIZE	(1ULL << 12)	/* set default i/o size */
> +#define XFS_MOUNT_ALLOCSIZE	(1ULL << 12)	/* specified allocation size */
>  #define XFS_MOUNT_SMALL_INUMS	(1ULL << 14)	/* user wants 32bit inodes */
>  #define XFS_MOUNT_32BITINODES	(1ULL << 15)	/* inode32 allocator active */
>  #define XFS_MOUNT_NOUUID	(1ULL << 16)	/* ignore uuid during mount */
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 3e5002d2a79e..a7d89b87ed22 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -228,7 +228,7 @@ xfs_parseargs(
>  			if (suffix_kstrtoint(args, 10, &size))
>  				return -EINVAL;
>  			mp->m_allocsize_log = ffs(size) - 1;
> -			mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
> +			mp->m_flags |= XFS_MOUNT_ALLOCSIZE;
>  			break;
>  		case Opt_grpid:
>  		case Opt_bsdgroups:
> @@ -396,7 +396,7 @@ xfs_parseargs(
>  		return -EINVAL;
>  	}
>  
> -	if ((mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) &&
> +	if ((mp->m_flags & XFS_MOUNT_ALLOCSIZE) &&
>  	    (mp->m_allocsize_log > XFS_MAX_IO_LOG ||
>  	     mp->m_allocsize_log < XFS_MIN_IO_LOG)) {
>  		xfs_warn(mp, "invalid log iosize: %d [not %d-%d]",
> @@ -450,7 +450,7 @@ xfs_showargs(
>  			seq_puts(m, xfs_infop->str);
>  	}
>  
> -	if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
> +	if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
>  		seq_printf(m, ",allocsize=%dk",
>  				(int)(1 << mp->m_allocsize_log) >> 10);
>  
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 09/12] xfs: reverse the polarity of XFS_MOUNT_COMPAT_IOSIZE
  2019-10-27 14:55 ` [PATCH 09/12] xfs: reverse the polarity of XFS_MOUNT_COMPAT_IOSIZE Christoph Hellwig
@ 2019-10-28 17:13   ` Darrick J. Wong
  0 siblings, 0 replies; 25+ messages in thread
From: Darrick J. Wong @ 2019-10-28 17:13 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, Ian Kent, Eric Sandeen

On Sun, Oct 27, 2019 at 03:55:44PM +0100, Christoph Hellwig wrote:
> Replace XFS_MOUNT_COMPAT_IOSIZE with an inverted XFS_MOUNT_LARGEIO flag
> that makes the usage more clear.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>

Makes much more sense,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_iops.c  |  2 +-
>  fs/xfs/xfs_mount.h |  2 +-
>  fs/xfs/xfs_super.c | 12 +++---------
>  3 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 9e1f89cdcc82..18e45e3a3f9f 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -510,7 +510,7 @@ xfs_stat_blksize(
>  	 * default buffered I/O size, return that, otherwise return the compat
>  	 * default.
>  	 */
> -	if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE)) {
> +	if (mp->m_flags & XFS_MOUNT_LARGEIO) {
>  		if (mp->m_swidth)
>  			return mp->m_swidth << mp->m_sb.sb_blocklog;
>  		if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index e5c364f1605e..a46cb3fd24b1 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -236,7 +236,7 @@ typedef struct xfs_mount {
>  						 * allocation */
>  #define XFS_MOUNT_RDONLY	(1ULL << 20)	/* read-only fs */
>  #define XFS_MOUNT_DIRSYNC	(1ULL << 21)	/* synchronous directory ops */
> -#define XFS_MOUNT_COMPAT_IOSIZE	(1ULL << 22)	/* don't report large preferred
> +#define XFS_MOUNT_LARGEIO	(1ULL << 22)	/* report large preferred
>  						 * I/O size in stat() */
>  #define XFS_MOUNT_FILESTREAMS	(1ULL << 24)	/* enable the filestreams
>  						   allocator */
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index a7d89b87ed22..f21c59822a38 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -180,12 +180,6 @@ xfs_parseargs(
>  	if (sb->s_flags & SB_SYNCHRONOUS)
>  		mp->m_flags |= XFS_MOUNT_WSYNC;
>  
> -	/*
> -	 * Set some default flags that could be cleared by the mount option
> -	 * parsing.
> -	 */
> -	mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;
> -
>  	/*
>  	 * These can be overridden by the mount option parsing.
>  	 */
> @@ -274,10 +268,10 @@ xfs_parseargs(
>  			mp->m_flags &= ~XFS_MOUNT_IKEEP;
>  			break;
>  		case Opt_largeio:
> -			mp->m_flags &= ~XFS_MOUNT_COMPAT_IOSIZE;
> +			mp->m_flags |= XFS_MOUNT_LARGEIO;
>  			break;
>  		case Opt_nolargeio:
> -			mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;
> +			mp->m_flags &= ~XFS_MOUNT_LARGEIO;
>  			break;
>  		case Opt_attr2:
>  			mp->m_flags |= XFS_MOUNT_ATTR2;
> @@ -430,12 +424,12 @@ xfs_showargs(
>  		{ XFS_MOUNT_GRPID,		",grpid" },
>  		{ XFS_MOUNT_DISCARD,		",discard" },
>  		{ XFS_MOUNT_SMALL_INUMS,	",inode32" },
> +		{ XFS_MOUNT_LARGEIO,		",largeio" },
>  		{ XFS_MOUNT_DAX,		",dax" },
>  		{ 0, NULL }
>  	};
>  	static struct proc_xfs_info xfs_info_unset[] = {
>  		/* the few simple ones we can get from the mount struct */
> -		{ XFS_MOUNT_COMPAT_IOSIZE,	",largeio" },
>  		{ XFS_MOUNT_SMALL_INUMS,	",inode64" },
>  		{ 0, NULL }
>  	};
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 10/12] xfs: clean up printing the allocsize option in xfs_showargs
  2019-10-27 14:55 ` [PATCH 10/12] xfs: clean up printing the allocsize option in xfs_showargs Christoph Hellwig
@ 2019-10-28 17:13   ` Darrick J. Wong
  0 siblings, 0 replies; 25+ messages in thread
From: Darrick J. Wong @ 2019-10-28 17:13 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, Ian Kent

On Sun, Oct 27, 2019 at 03:55:45PM +0100, Christoph Hellwig wrote:
> Remove superflous cast.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index f21c59822a38..93ed0871b1cf 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -446,7 +446,7 @@ xfs_showargs(
>  
>  	if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
>  		seq_printf(m, ",allocsize=%dk",
> -				(int)(1 << mp->m_allocsize_log) >> 10);
> +			   (1 << mp->m_allocsize_log) >> 10);
>  
>  	if (mp->m_logbufs > 0)
>  		seq_printf(m, ",logbufs=%d", mp->m_logbufs);
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 11/12] xfs: clean up printing inode32/64 in xfs_showargs
  2019-10-27 14:55 ` [PATCH 11/12] xfs: clean up printing inode32/64 " Christoph Hellwig
@ 2019-10-28 17:14   ` Darrick J. Wong
  0 siblings, 0 replies; 25+ messages in thread
From: Darrick J. Wong @ 2019-10-28 17:14 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, Ian Kent

On Sun, Oct 27, 2019 at 03:55:46PM +0100, Christoph Hellwig wrote:
> inode64 is the only value remaining in the unset array.  Special case
> the inode32/64 options with an explicit seq_printf that prints either
> inode32 or inode64, and remove the unset array.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_super.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 93ed0871b1cf..0e8942bbf840 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -423,26 +423,19 @@ xfs_showargs(
>  		{ XFS_MOUNT_FILESTREAMS,	",filestreams" },
>  		{ XFS_MOUNT_GRPID,		",grpid" },
>  		{ XFS_MOUNT_DISCARD,		",discard" },
> -		{ XFS_MOUNT_SMALL_INUMS,	",inode32" },
>  		{ XFS_MOUNT_LARGEIO,		",largeio" },
>  		{ XFS_MOUNT_DAX,		",dax" },
>  		{ 0, NULL }
>  	};
> -	static struct proc_xfs_info xfs_info_unset[] = {
> -		/* the few simple ones we can get from the mount struct */
> -		{ XFS_MOUNT_SMALL_INUMS,	",inode64" },
> -		{ 0, NULL }
> -	};
>  	struct proc_xfs_info	*xfs_infop;
>  
>  	for (xfs_infop = xfs_info_set; xfs_infop->flag; xfs_infop++) {
>  		if (mp->m_flags & xfs_infop->flag)
>  			seq_puts(m, xfs_infop->str);
>  	}
> -	for (xfs_infop = xfs_info_unset; xfs_infop->flag; xfs_infop++) {
> -		if (!(mp->m_flags & xfs_infop->flag))
> -			seq_puts(m, xfs_infop->str);
> -	}
> +
> +	seq_printf(m, ",inode%d",
> +		(mp->m_flags & XFS_MOUNT_SMALL_INUMS) ? 32 : 64);
>  
>  	if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
>  		seq_printf(m, ",allocsize=%dk",
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 12/12] xfs: merge xfs_showargs into xfs_fs_show_options
  2019-10-27 14:55 ` [PATCH 12/12] xfs: merge xfs_showargs into xfs_fs_show_options Christoph Hellwig
@ 2019-10-28 17:14   ` Darrick J. Wong
  0 siblings, 0 replies; 25+ messages in thread
From: Darrick J. Wong @ 2019-10-28 17:14 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, Ian Kent

On Sun, Oct 27, 2019 at 03:55:47PM +0100, Christoph Hellwig wrote:
> No need for a trivial wrapper.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_super.c | 20 +++++++-------------
>  1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 0e8942bbf840..bcb1575a5652 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -406,10 +406,10 @@ struct proc_xfs_info {
>  	char		*str;
>  };
>  
> -STATIC void
> -xfs_showargs(
> -	struct xfs_mount	*mp,
> -	struct seq_file		*m)
> +static int
> +xfs_fs_show_options(
> +	struct seq_file		*m,
> +	struct dentry		*root)
>  {
>  	static struct proc_xfs_info xfs_info_set[] = {
>  		/* the few simple ones we can get from the mount struct */
> @@ -427,6 +427,7 @@ xfs_showargs(
>  		{ XFS_MOUNT_DAX,		",dax" },
>  		{ 0, NULL }
>  	};
> +	struct xfs_mount	*mp = XFS_M(root->d_sb);
>  	struct proc_xfs_info	*xfs_infop;
>  
>  	for (xfs_infop = xfs_info_set; xfs_infop->flag; xfs_infop++) {
> @@ -478,6 +479,8 @@ xfs_showargs(
>  
>  	if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT))
>  		seq_puts(m, ",noquota");
> +
> +	return 0;
>  }
>  
>  static uint64_t
> @@ -1378,15 +1381,6 @@ xfs_fs_unfreeze(
>  	return 0;
>  }
>  
> -STATIC int
> -xfs_fs_show_options(
> -	struct seq_file		*m,
> -	struct dentry		*root)
> -{
> -	xfs_showargs(XFS_M(root->d_sb), m);
> -	return 0;
> -}
> -
>  /*
>   * This function fills in xfs_mount_t fields based on mount args.
>   * Note: the superblock _has_ now been read in.
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 08/12] xfs: rename the XFS_MOUNT_DFLT_IOSIZE option to XFS_MOUNT_ALLOCISZE
  2019-10-28 17:12   ` Darrick J. Wong
@ 2019-10-29  7:50     ` Christoph Hellwig
  0 siblings, 0 replies; 25+ messages in thread
From: Christoph Hellwig @ 2019-10-29  7:50 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, linux-xfs, Ian Kent

On Mon, Oct 28, 2019 at 10:12:36AM -0700, Darrick J. Wong wrote:
> s/ALLOCISZE/ALLOCSIZE/ in the subject
> 
> On Sun, Oct 27, 2019 at 03:55:43PM +0100, Christoph Hellwig wrote:
> > Make the flag match the mount option and usage.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> With that fixed,
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

Feel free to fix up when applying the patch :)

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2019-10-29  7:50 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-27 14:55 decruft misc mount related code v2 Christoph Hellwig
2019-10-27 14:55 ` [PATCH 01/12] xfs: remove the biosize mount option Christoph Hellwig
2019-10-27 14:55 ` [PATCH 02/12] xfs: remove the dsunit and dswidth variables in xfs_parseargs Christoph Hellwig
2019-10-28 16:50   ` Darrick J. Wong
2019-10-27 14:55 ` [PATCH 03/12] xfs: cleanup calculating the stat optimal I/O size Christoph Hellwig
2019-10-28 16:50   ` Darrick J. Wong
2019-10-27 14:55 ` [PATCH 04/12] xfs: don't use a different allocsice for -o wsync mounts Christoph Hellwig
2019-10-28 17:05   ` Darrick J. Wong
2019-10-27 14:55 ` [PATCH 05/12] xfs: remove the m_readio_* fields in struct xfs_mount Christoph Hellwig
2019-10-28 17:06   ` Darrick J. Wong
2019-10-27 14:55 ` [PATCH 06/12] xfs: rename the m_writeio_* " Christoph Hellwig
2019-10-28 17:07   ` Darrick J. Wong
2019-10-27 14:55 ` [PATCH 07/12] xfs: simplify parsing of allocsize mount option Christoph Hellwig
2019-10-28 17:11   ` Darrick J. Wong
2019-10-27 14:55 ` [PATCH 08/12] xfs: rename the XFS_MOUNT_DFLT_IOSIZE option to XFS_MOUNT_ALLOCISZE Christoph Hellwig
2019-10-28 17:12   ` Darrick J. Wong
2019-10-29  7:50     ` Christoph Hellwig
2019-10-27 14:55 ` [PATCH 09/12] xfs: reverse the polarity of XFS_MOUNT_COMPAT_IOSIZE Christoph Hellwig
2019-10-28 17:13   ` Darrick J. Wong
2019-10-27 14:55 ` [PATCH 10/12] xfs: clean up printing the allocsize option in xfs_showargs Christoph Hellwig
2019-10-28 17:13   ` Darrick J. Wong
2019-10-27 14:55 ` [PATCH 11/12] xfs: clean up printing inode32/64 " Christoph Hellwig
2019-10-28 17:14   ` Darrick J. Wong
2019-10-27 14:55 ` [PATCH 12/12] xfs: merge xfs_showargs into xfs_fs_show_options Christoph Hellwig
2019-10-28 17:14   ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).