}
/*
- * 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.
*/
void
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);
#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.
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
*/
mp->m_logbufs = -1;
mp->m_logbsize = -1;
+ mp->m_allocsize_log = 16; /* 64k */
if (!options)
goto done;
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:
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;