[XFS] optimize XFS_IS_REALTIME_INODE w/o realtime config
Use XFS_IS_REALTIME_INODE in more places, and #define it to 0 if CONFIG_XFS_RT is off. This should be safe because mount checks in xfs_rtmount_init: so if we get mounted w/o CONFIG_XFS_RT, no realtime inodes should be encountered after that. Defining XFS_IS_REALTIME_INODE to 0 saves a bit of stack space, presumeably gcc can optimize around the various "if (0)" type checks: xfs_alloc_file_space -8 xfs_bmap_adjacent -16 xfs_bmapi -8 xfs_bmap_rtalloc -16 xfs_bunmapi -28 xfs_free_file_space -64 xfs_imap +8 <-- ? hmm. xfs_iomap_write_direct -12 xfs_qm_dqusage_adjust -4 xfs_qm_vop_chown_reserve -4 SGI-PV: 971186 SGI-Modid: xfs-linux-melb:xfs-kern:30014a Signed-off-by: Eric Sandeen <sandeen@sandeen.net> Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
This commit is contained in:
committed by
Lachlan McIlroy
parent
a67d7c5f5d
commit
71ddabb94a
@@ -113,7 +113,7 @@ xfs_find_bdev_for_inode(
|
|||||||
{
|
{
|
||||||
struct xfs_mount *mp = ip->i_mount;
|
struct xfs_mount *mp = ip->i_mount;
|
||||||
|
|
||||||
if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)
|
if (XFS_IS_REALTIME_INODE(ip))
|
||||||
return mp->m_rtdev_targp->bt_bdev;
|
return mp->m_rtdev_targp->bt_bdev;
|
||||||
else
|
else
|
||||||
return mp->m_ddev_targp->bt_bdev;
|
return mp->m_ddev_targp->bt_bdev;
|
||||||
|
|||||||
@@ -741,7 +741,7 @@ xfs_ioctl(
|
|||||||
case XFS_IOC_DIOINFO: {
|
case XFS_IOC_DIOINFO: {
|
||||||
struct dioattr da;
|
struct dioattr da;
|
||||||
xfs_buftarg_t *target =
|
xfs_buftarg_t *target =
|
||||||
(ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
|
XFS_IS_REALTIME_INODE(ip) ?
|
||||||
mp->m_rtdev_targp : mp->m_ddev_targp;
|
mp->m_rtdev_targp : mp->m_ddev_targp;
|
||||||
|
|
||||||
da.d_mem = da.d_miniosz = 1 << target->bt_sshift;
|
da.d_mem = da.d_miniosz = 1 << target->bt_sshift;
|
||||||
|
|||||||
@@ -612,7 +612,7 @@ xfs_vn_getattr(
|
|||||||
sysv_minor(ip->i_df.if_u2.if_rdev));
|
sysv_minor(ip->i_df.if_u2.if_rdev));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) {
|
if (XFS_IS_REALTIME_INODE(ip)) {
|
||||||
/*
|
/*
|
||||||
* If the file blocks are being allocated from a
|
* If the file blocks are being allocated from a
|
||||||
* realtime volume, then return the inode's realtime
|
* realtime volume, then return the inode's realtime
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ xfs_read(
|
|||||||
|
|
||||||
if (unlikely(ioflags & IO_ISDIRECT)) {
|
if (unlikely(ioflags & IO_ISDIRECT)) {
|
||||||
xfs_buftarg_t *target =
|
xfs_buftarg_t *target =
|
||||||
(ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
|
XFS_IS_REALTIME_INODE(ip) ?
|
||||||
mp->m_rtdev_targp : mp->m_ddev_targp;
|
mp->m_rtdev_targp : mp->m_ddev_targp;
|
||||||
if ((*offset & target->bt_smask) ||
|
if ((*offset & target->bt_smask) ||
|
||||||
(size & target->bt_smask)) {
|
(size & target->bt_smask)) {
|
||||||
@@ -657,7 +657,7 @@ start:
|
|||||||
|
|
||||||
if (ioflags & IO_ISDIRECT) {
|
if (ioflags & IO_ISDIRECT) {
|
||||||
xfs_buftarg_t *target =
|
xfs_buftarg_t *target =
|
||||||
(xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
|
XFS_IS_REALTIME_INODE(xip) ?
|
||||||
mp->m_rtdev_targp : mp->m_ddev_targp;
|
mp->m_rtdev_targp : mp->m_ddev_targp;
|
||||||
|
|
||||||
if ((pos & target->bt_smask) || (count & target->bt_smask)) {
|
if ((pos & target->bt_smask) || (count & target->bt_smask)) {
|
||||||
|
|||||||
@@ -2969,7 +2969,7 @@ STATIC int
|
|||||||
xfs_bmap_alloc(
|
xfs_bmap_alloc(
|
||||||
xfs_bmalloca_t *ap) /* bmap alloc argument struct */
|
xfs_bmalloca_t *ap) /* bmap alloc argument struct */
|
||||||
{
|
{
|
||||||
if ((ap->ip->i_d.di_flags & XFS_DIFLAG_REALTIME) && ap->userdata)
|
if (XFS_IS_REALTIME_INODE(ap->ip) && ap->userdata)
|
||||||
return xfs_bmap_rtalloc(ap);
|
return xfs_bmap_rtalloc(ap);
|
||||||
return xfs_bmap_btalloc(ap);
|
return xfs_bmap_btalloc(ap);
|
||||||
}
|
}
|
||||||
@@ -3096,8 +3096,7 @@ xfs_bmap_del_extent(
|
|||||||
/*
|
/*
|
||||||
* Realtime allocation. Free it and record di_nblocks update.
|
* Realtime allocation. Free it and record di_nblocks update.
|
||||||
*/
|
*/
|
||||||
if (whichfork == XFS_DATA_FORK &&
|
if (whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip)) {
|
||||||
(ip->i_d.di_flags & XFS_DIFLAG_REALTIME)) {
|
|
||||||
xfs_fsblock_t bno;
|
xfs_fsblock_t bno;
|
||||||
xfs_filblks_t len;
|
xfs_filblks_t len;
|
||||||
|
|
||||||
|
|||||||
@@ -2062,8 +2062,7 @@ xfs_bmbt_insert(
|
|||||||
pcur->bc_private.b.allocated;
|
pcur->bc_private.b.allocated;
|
||||||
pcur->bc_private.b.allocated = 0;
|
pcur->bc_private.b.allocated = 0;
|
||||||
ASSERT((cur->bc_private.b.firstblock != NULLFSBLOCK) ||
|
ASSERT((cur->bc_private.b.firstblock != NULLFSBLOCK) ||
|
||||||
(cur->bc_private.b.ip->i_d.di_flags &
|
XFS_IS_REALTIME_INODE(cur->bc_private.b.ip));
|
||||||
XFS_DIFLAG_REALTIME));
|
|
||||||
cur->bc_private.b.firstblock =
|
cur->bc_private.b.firstblock =
|
||||||
pcur->bc_private.b.firstblock;
|
pcur->bc_private.b.firstblock;
|
||||||
ASSERT(cur->bc_private.b.flist ==
|
ASSERT(cur->bc_private.b.flist ==
|
||||||
|
|||||||
@@ -185,8 +185,7 @@ xfs_swap_extents(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Verify both files are either real-time or non-realtime */
|
/* Verify both files are either real-time or non-realtime */
|
||||||
if ((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) !=
|
if (XFS_IS_REALTIME_INODE(ip) != XFS_IS_REALTIME_INODE(tip)) {
|
||||||
(tip->i_d.di_flags & XFS_DIFLAG_REALTIME)) {
|
|
||||||
error = XFS_ERROR(EINVAL);
|
error = XFS_ERROR(EINVAL);
|
||||||
goto error0;
|
goto error0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -273,6 +273,12 @@ typedef enum xfs_dinode_fmt
|
|||||||
#define XFS_DIFLAG_NODEFRAG (1 << XFS_DIFLAG_NODEFRAG_BIT)
|
#define XFS_DIFLAG_NODEFRAG (1 << XFS_DIFLAG_NODEFRAG_BIT)
|
||||||
#define XFS_DIFLAG_FILESTREAM (1 << XFS_DIFLAG_FILESTREAM_BIT)
|
#define XFS_DIFLAG_FILESTREAM (1 << XFS_DIFLAG_FILESTREAM_BIT)
|
||||||
|
|
||||||
|
#ifdef CONFIG_XFS_RT
|
||||||
|
#define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
|
||||||
|
#else
|
||||||
|
#define XFS_IS_REALTIME_INODE(ip) (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define XFS_DIFLAG_ANY \
|
#define XFS_DIFLAG_ANY \
|
||||||
(XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \
|
(XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \
|
||||||
XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
|
XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
|
||||||
|
|||||||
@@ -1296,7 +1296,10 @@ xfs_isize_check(
|
|||||||
if ((ip->i_d.di_mode & S_IFMT) != S_IFREG)
|
if ((ip->i_d.di_mode & S_IFMT) != S_IFREG)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ip->i_d.di_flags & (XFS_DIFLAG_REALTIME | XFS_DIFLAG_EXTSIZE))
|
if (XFS_IS_REALTIME_INODE(ip))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nimaps = 2;
|
nimaps = 2;
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ xfs_imap_to_bmap(
|
|||||||
iomapp->iomap_bsize = XFS_FSB_TO_B(mp, imap->br_blockcount);
|
iomapp->iomap_bsize = XFS_FSB_TO_B(mp, imap->br_blockcount);
|
||||||
iomapp->iomap_flags = flags;
|
iomapp->iomap_flags = flags;
|
||||||
|
|
||||||
if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) {
|
if (XFS_IS_REALTIME_INODE(ip)) {
|
||||||
iomapp->iomap_flags |= IOMAP_REALTIME;
|
iomapp->iomap_flags |= IOMAP_REALTIME;
|
||||||
iomapp->iomap_target = mp->m_rtdev_targp;
|
iomapp->iomap_target = mp->m_rtdev_targp;
|
||||||
} else {
|
} else {
|
||||||
@@ -298,7 +298,7 @@ xfs_iomap_eof_align_last_fsb(
|
|||||||
xfs_extlen_t align;
|
xfs_extlen_t align;
|
||||||
int eof, error;
|
int eof, error;
|
||||||
|
|
||||||
if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)
|
if (XFS_IS_REALTIME_INODE(ip))
|
||||||
;
|
;
|
||||||
/*
|
/*
|
||||||
* If mounted with the "-o swalloc" option, roundup the allocation
|
* If mounted with the "-o swalloc" option, roundup the allocation
|
||||||
@@ -524,7 +524,7 @@ xfs_iomap_write_direct(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(!imap.br_startblock &&
|
if (unlikely(!imap.br_startblock &&
|
||||||
!(ip->i_d.di_flags & XFS_DIFLAG_REALTIME))) {
|
!(XFS_IS_REALTIME_INODE(ip)))) {
|
||||||
error = xfs_cmn_err_fsblock_zero(ip, &imap);
|
error = xfs_cmn_err_fsblock_zero(ip, &imap);
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
@@ -687,7 +687,7 @@ retry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(!imap[0].br_startblock &&
|
if (unlikely(!imap[0].br_startblock &&
|
||||||
!(ip->i_d.di_flags & XFS_DIFLAG_REALTIME)))
|
!(XFS_IS_REALTIME_INODE(ip))))
|
||||||
return xfs_cmn_err_fsblock_zero(ip, &imap[0]);
|
return xfs_cmn_err_fsblock_zero(ip, &imap[0]);
|
||||||
|
|
||||||
*ret_imap = imap[0];
|
*ret_imap = imap[0];
|
||||||
@@ -932,7 +932,7 @@ xfs_iomap_write_unwritten(
|
|||||||
return XFS_ERROR(error);
|
return XFS_ERROR(error);
|
||||||
|
|
||||||
if (unlikely(!imap.br_startblock &&
|
if (unlikely(!imap.br_startblock &&
|
||||||
!(ip->i_d.di_flags & XFS_DIFLAG_REALTIME)))
|
!(XFS_IS_REALTIME_INODE(ip))))
|
||||||
return xfs_cmn_err_fsblock_zero(ip, &imap);
|
return xfs_cmn_err_fsblock_zero(ip, &imap);
|
||||||
|
|
||||||
if ((numblks_fsb = imap.br_blockcount) == 0) {
|
if ((numblks_fsb = imap.br_blockcount) == 0) {
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
struct xfs_mount;
|
struct xfs_mount;
|
||||||
struct xfs_trans;
|
struct xfs_trans;
|
||||||
|
|
||||||
#define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
|
|
||||||
|
|
||||||
/* Min and max rt extent sizes, specified in bytes */
|
/* Min and max rt extent sizes, specified in bytes */
|
||||||
#define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024) /* 1GB */
|
#define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024) /* 1GB */
|
||||||
#define XFS_DFL_RTEXTSIZE (64 * 1024) /* 64KB */
|
#define XFS_DFL_RTEXTSIZE (64 * 1024) /* 64KB */
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ struct xfs_mount;
|
|||||||
static inline xfs_daddr_t
|
static inline xfs_daddr_t
|
||||||
xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb)
|
xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb)
|
||||||
{
|
{
|
||||||
return (((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME) ? \
|
return (XFS_IS_REALTIME_INODE(ip) ? \
|
||||||
(xfs_daddr_t)XFS_FSB_TO_BB((ip)->i_mount, (fsb)) : \
|
(xfs_daddr_t)XFS_FSB_TO_BB((ip)->i_mount, (fsb)) : \
|
||||||
XFS_FSB_TO_DADDR((ip)->i_mount, (fsb)));
|
XFS_FSB_TO_DADDR((ip)->i_mount, (fsb)));
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ xfs_get_extsz_hint(
|
|||||||
{
|
{
|
||||||
xfs_extlen_t extsz;
|
xfs_extlen_t extsz;
|
||||||
|
|
||||||
if (unlikely(ip->i_d.di_flags & XFS_DIFLAG_REALTIME)) {
|
if (unlikely(XFS_IS_REALTIME_INODE(ip))) {
|
||||||
extsz = (ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE)
|
extsz = (ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE)
|
||||||
? ip->i_d.di_extsize
|
? ip->i_d.di_extsize
|
||||||
: ip->i_mount->m_sb.sb_rextsize;
|
: ip->i_mount->m_sb.sb_rextsize;
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ xfs_getattr(
|
|||||||
default:
|
default:
|
||||||
vap->va_rdev = 0;
|
vap->va_rdev = 0;
|
||||||
|
|
||||||
if (!(ip->i_d.di_flags & XFS_DIFLAG_REALTIME)) {
|
if (!(XFS_IS_REALTIME_INODE(ip))) {
|
||||||
vap->va_blocksize = xfs_preferred_iosize(mp);
|
vap->va_blocksize = xfs_preferred_iosize(mp);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -508,7 +508,7 @@ xfs_setattr(
|
|||||||
*/
|
*/
|
||||||
if ((ip->i_d.di_nextents || ip->i_delayed_blks) &&
|
if ((ip->i_d.di_nextents || ip->i_delayed_blks) &&
|
||||||
(mask & XFS_AT_XFLAGS) &&
|
(mask & XFS_AT_XFLAGS) &&
|
||||||
(ip->i_d.di_flags & XFS_DIFLAG_REALTIME) !=
|
(XFS_IS_REALTIME_INODE(ip)) !=
|
||||||
(vap->va_xflags & XFS_XFLAG_REALTIME)) {
|
(vap->va_xflags & XFS_XFLAG_REALTIME)) {
|
||||||
code = XFS_ERROR(EINVAL); /* EFBIG? */
|
code = XFS_ERROR(EINVAL); /* EFBIG? */
|
||||||
goto error_return;
|
goto error_return;
|
||||||
@@ -520,7 +520,7 @@ xfs_setattr(
|
|||||||
if ((mask & XFS_AT_EXTSIZE) && vap->va_extsize != 0) {
|
if ((mask & XFS_AT_EXTSIZE) && vap->va_extsize != 0) {
|
||||||
xfs_extlen_t size;
|
xfs_extlen_t size;
|
||||||
|
|
||||||
if ((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ||
|
if (XFS_IS_REALTIME_INODE(ip) ||
|
||||||
((mask & XFS_AT_XFLAGS) &&
|
((mask & XFS_AT_XFLAGS) &&
|
||||||
(vap->va_xflags & XFS_XFLAG_REALTIME))) {
|
(vap->va_xflags & XFS_XFLAG_REALTIME))) {
|
||||||
size = mp->m_sb.sb_rextsize <<
|
size = mp->m_sb.sb_rextsize <<
|
||||||
@@ -1144,7 +1144,7 @@ xfs_fsync(
|
|||||||
* If this inode is on the RT dev we need to flush that
|
* If this inode is on the RT dev we need to flush that
|
||||||
* cache as well.
|
* cache as well.
|
||||||
*/
|
*/
|
||||||
if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)
|
if (XFS_IS_REALTIME_INODE(ip))
|
||||||
xfs_blkdev_issue_flush(ip->i_mount->m_rtdev_targp);
|
xfs_blkdev_issue_flush(ip->i_mount->m_rtdev_targp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4044,7 +4044,7 @@ xfs_zero_remaining_bytes(
|
|||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
bp = xfs_buf_get_noaddr(mp->m_sb.sb_blocksize,
|
bp = xfs_buf_get_noaddr(mp->m_sb.sb_blocksize,
|
||||||
ip->i_d.di_flags & XFS_DIFLAG_REALTIME ?
|
XFS_IS_REALTIME_INODE(ip) ?
|
||||||
mp->m_rtdev_targp : mp->m_ddev_targp);
|
mp->m_rtdev_targp : mp->m_ddev_targp);
|
||||||
|
|
||||||
for (offset = startoff; offset <= endoff; offset = lastoffset + 1) {
|
for (offset = startoff; offset <= endoff; offset = lastoffset + 1) {
|
||||||
@@ -4141,7 +4141,7 @@ xfs_free_file_space(
|
|||||||
error = 0;
|
error = 0;
|
||||||
if (len <= 0) /* if nothing being freed */
|
if (len <= 0) /* if nothing being freed */
|
||||||
return error;
|
return error;
|
||||||
rt = (ip->i_d.di_flags & XFS_DIFLAG_REALTIME);
|
rt = XFS_IS_REALTIME_INODE(ip);
|
||||||
startoffset_fsb = XFS_B_TO_FSB(mp, offset);
|
startoffset_fsb = XFS_B_TO_FSB(mp, offset);
|
||||||
end_dmi_offset = offset + len;
|
end_dmi_offset = offset + len;
|
||||||
endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset);
|
endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset);
|
||||||
|
|||||||
Reference in New Issue
Block a user