mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 23:29:46 +00:00
xfs: cleanup calculating the stat optimal I/O size
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> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
parent
69e8575dee
commit
dd2d535e3f
@ -484,6 +484,42 @@ xfs_vn_get_link_inline(
|
|||||||
return link;
|
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
|
STATIC int
|
||||||
xfs_vn_getattr(
|
xfs_vn_getattr(
|
||||||
const struct path *path,
|
const struct path *path,
|
||||||
@ -543,16 +579,7 @@ xfs_vn_getattr(
|
|||||||
stat->rdev = inode->i_rdev;
|
stat->rdev = inode->i_rdev;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (XFS_IS_REALTIME_INODE(ip)) {
|
stat->blksize = xfs_stat_blksize(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->rdev = 0;
|
stat->rdev = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -267,30 +267,6 @@ typedef struct xfs_mount {
|
|||||||
#define XFS_WSYNC_READIO_LOG 15 /* 32k */
|
#define XFS_WSYNC_READIO_LOG 15 /* 32k */
|
||||||
#define XFS_WSYNC_WRITEIO_LOG 14 /* 16k */
|
#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) \
|
#define XFS_LAST_UNMOUNT_WAS_CLEAN(mp) \
|
||||||
((mp)->m_flags & XFS_MOUNT_WAS_CLEAN)
|
((mp)->m_flags & XFS_MOUNT_WAS_CLEAN)
|
||||||
#define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN)
|
#define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user