summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_super.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-10-28 08:41:45 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2019-10-29 09:50:13 -0700
commit2fcddee8cd8fcce4cc5589a0344f40a28a6dd26f (patch)
tree59eb7224fd11149dc822bb659f48095dda2361df /fs/xfs/xfs_super.c
parent5da8a07c79e8a1c151737254117df57627ae93fa (diff)
downloadlinux-2fcddee8cd8fcce4cc5589a0344f40a28a6dd26f.tar.bz2
xfs: simplify parsing of allocsize mount option
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> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_super.c')
-rw-r--r--fs/xfs/xfs_super.c26
1 files changed, 11 insertions, 15 deletions
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 @@ done:
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;