Commit 71c029eb authored by Nathan Scott's avatar Nathan Scott Committed by Christoph Hellwig

[XFS] Remove a void* from the xfs_mount structure, move the log stripe mask

field from the xfs_mount structure to the log structure (saves a couple
of pointer dereferences when writing to the log, with v2 logs only).

SGI Modid: 2.5.x-xfs:slinx:149395a
parent fb39ee00
...@@ -497,8 +497,6 @@ xfs_log_mount(xfs_mount_t *mp, ...@@ -497,8 +497,6 @@ xfs_log_mount(xfs_mount_t *mp,
xfs_daddr_t blk_offset, xfs_daddr_t blk_offset,
int num_bblks) int num_bblks)
{ {
xlog_t *log;
if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) if (!(mp->m_flags & XFS_MOUNT_NORECOVERY))
cmn_err(CE_NOTE, "XFS mounting filesystem %s", mp->m_fsname); cmn_err(CE_NOTE, "XFS mounting filesystem %s", mp->m_fsname);
else { else {
...@@ -508,7 +506,7 @@ xfs_log_mount(xfs_mount_t *mp, ...@@ -508,7 +506,7 @@ xfs_log_mount(xfs_mount_t *mp,
ASSERT(XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY); ASSERT(XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY);
} }
mp->m_log = log = xlog_alloc_log(mp, log_dev, blk_offset, num_bblks); mp->m_log = xlog_alloc_log(mp, log_dev, blk_offset, num_bblks);
#if defined(DEBUG) || defined(XLOG_NOLOG) #if defined(DEBUG) || defined(XLOG_NOLOG)
if (! xlog_debug) { if (! xlog_debug) {
...@@ -528,19 +526,19 @@ xfs_log_mount(xfs_mount_t *mp, ...@@ -528,19 +526,19 @@ xfs_log_mount(xfs_mount_t *mp,
if (readonly) if (readonly)
vfsp->vfs_flag &= ~VFS_RDONLY; vfsp->vfs_flag &= ~VFS_RDONLY;
error = xlog_recover(log, readonly); error = xlog_recover(mp->m_log, readonly);
if (readonly) if (readonly)
vfsp->vfs_flag |= VFS_RDONLY; vfsp->vfs_flag |= VFS_RDONLY;
if (error) { if (error) {
cmn_err(CE_WARN, "XFS: log mount/recovery failed"); cmn_err(CE_WARN, "XFS: log mount/recovery failed");
xlog_unalloc_log(log); xlog_unalloc_log(mp->m_log);
return error; return error;
} }
} }
/* Normal transactions can now occur */ /* Normal transactions can now occur */
log->l_flags &= ~XLOG_ACTIVE_RECOVERY; mp->m_log->l_flags &= ~XLOG_ACTIVE_RECOVERY;
/* End mounting message in xfs_log_mount_finish */ /* End mounting message in xfs_log_mount_finish */
return 0; return 0;
...@@ -1191,7 +1189,7 @@ xlog_alloc_log(xfs_mount_t *mp, ...@@ -1191,7 +1189,7 @@ xlog_alloc_log(xfs_mount_t *mp,
int i; int i;
int iclogsize; int iclogsize;
log = (void *)kmem_zalloc(sizeof(xlog_t), KM_SLEEP); log = (xlog_t *)kmem_zalloc(sizeof(xlog_t), KM_SLEEP);
log->l_mp = mp; log->l_mp = mp;
log->l_dev = log_dev; log->l_dev = log_dev;
...@@ -1209,6 +1207,14 @@ xlog_alloc_log(xfs_mount_t *mp, ...@@ -1209,6 +1207,14 @@ xlog_alloc_log(xfs_mount_t *mp,
log->l_grant_reserve_cycle = 1; log->l_grant_reserve_cycle = 1;
log->l_grant_write_cycle = 1; log->l_grant_write_cycle = 1;
if (XFS_SB_VERSION_HASLOGV2(&mp->m_sb)) {
if (mp->m_sb.sb_logsunit <= 1) {
log->l_stripemask = 1;
} else {
log->l_stripemask = 1 <<
xfs_highbit32(mp->m_sb.sb_logsunit >> BBSHIFT);
}
}
if (XFS_SB_VERSION_HASSECTOR(&mp->m_sb)) { if (XFS_SB_VERSION_HASSECTOR(&mp->m_sb)) {
log->l_sectbb_log = mp->m_sb.sb_logsectlog - BBSHIFT; log->l_sectbb_log = mp->m_sb.sb_logsectlog - BBSHIFT;
ASSERT(log->l_sectbb_log <= mp->m_sectbb_log); ASSERT(log->l_sectbb_log <= mp->m_sectbb_log);
...@@ -2814,10 +2820,9 @@ xlog_state_switch_iclogs(xlog_t *log, ...@@ -2814,10 +2820,9 @@ xlog_state_switch_iclogs(xlog_t *log,
/* Round up to next log-sunit */ /* Round up to next log-sunit */
if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) { if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) {
if (log->l_curr_block & (log->l_mp->m_lstripemask - 1)) { if (log->l_curr_block & (log->l_stripemask - 1)) {
roundup = log->l_mp->m_lstripemask - roundup = log->l_stripemask -
(log->l_curr_block & (log->l_curr_block & (log->l_stripemask - 1));
(log->l_mp->m_lstripemask - 1));
} else { } else {
roundup = 0; roundup = 0;
} }
......
...@@ -533,6 +533,7 @@ typedef struct log { ...@@ -533,6 +533,7 @@ typedef struct log {
uint l_flags; uint l_flags;
uint l_quotaoffs_flag;/* XFS_DQ_*, if QUOTAOFFs found */ uint l_quotaoffs_flag;/* XFS_DQ_*, if QUOTAOFFs found */
struct xfs_buf_cancel **l_buf_cancel_table; struct xfs_buf_cancel **l_buf_cancel_table;
int l_stripemask; /* log stripe mask */
int l_iclog_hsize; /* size of iclog header */ int l_iclog_hsize; /* size of iclog header */
int l_iclog_heads; /* number of iclog header sectors */ int l_iclog_heads; /* number of iclog header sectors */
uint l_sectbb_log; /* log2 of sector size in bbs */ uint l_sectbb_log; /* log2 of sector size in bbs */
......
...@@ -560,16 +560,6 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) ...@@ -560,16 +560,6 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp)
mp->m_blockwmask = mp->m_blockwsize - 1; mp->m_blockwmask = mp->m_blockwsize - 1;
INIT_LIST_HEAD(&mp->m_del_inodes); INIT_LIST_HEAD(&mp->m_del_inodes);
if (XFS_SB_VERSION_HASLOGV2(sbp)) {
if (sbp->sb_logsunit <= 1) {
mp->m_lstripemask = 1;
} else {
mp->m_lstripemask =
1 << xfs_highbit32(sbp->sb_logsunit >> BBSHIFT);
}
}
/* /*
* Setup for attributes, in case they get created. * Setup for attributes, in case they get created.
* This value is for inodes getting attributes for the first time, * This value is for inodes getting attributes for the first time,
......
...@@ -68,6 +68,7 @@ typedef struct xfs_trans_reservations { ...@@ -68,6 +68,7 @@ typedef struct xfs_trans_reservations {
((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks)) ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks))
#else #else
struct cred; struct cred;
struct log;
struct vfs; struct vfs;
struct vnode; struct vnode;
struct xfs_mount_args; struct xfs_mount_args;
...@@ -303,7 +304,7 @@ typedef struct xfs_mount { ...@@ -303,7 +304,7 @@ typedef struct xfs_mount {
uint m_readio_blocks; /* min read size blocks */ uint m_readio_blocks; /* min read size blocks */
uint m_writeio_log; /* min write size log bytes */ uint m_writeio_log; /* min write size log bytes */
uint m_writeio_blocks; /* min write size blocks */ uint m_writeio_blocks; /* min write size blocks */
void *m_log; /* log specific stuff */ struct log *m_log; /* log specific stuff */
int m_logbufs; /* number of log buffers */ int m_logbufs; /* number of log buffers */
int m_logbsize; /* size of each log buffer */ int m_logbsize; /* size of each log buffer */
uint m_rsumlevels; /* rt summary levels */ uint m_rsumlevels; /* rt summary levels */
...@@ -358,7 +359,6 @@ typedef struct xfs_mount { ...@@ -358,7 +359,6 @@ typedef struct xfs_mount {
#endif #endif
int m_dalign; /* stripe unit */ int m_dalign; /* stripe unit */
int m_swidth; /* stripe width */ int m_swidth; /* stripe width */
int m_lstripemask; /* log stripe mask */
int m_sinoalign; /* stripe unit inode alignmnt */ int m_sinoalign; /* stripe unit inode alignmnt */
int m_attr_magicpct;/* 37% of the blocksize */ int m_attr_magicpct;/* 37% of the blocksize */
int m_dir_magicpct; /* 37% of the dir blocksize */ int m_dir_magicpct; /* 37% of the dir blocksize */
......
...@@ -4269,8 +4269,10 @@ xfsidbg_xlog(xlog_t *log) ...@@ -4269,8 +4269,10 @@ xfsidbg_xlog(xlog_t *log)
kdb_printf("iclog_bak: 0x%p iclog_size: 0x%x (%d) num iclogs: %d\n", kdb_printf("iclog_bak: 0x%p iclog_size: 0x%x (%d) num iclogs: %d\n",
log->l_iclog_bak, log->l_iclog_size, log->l_iclog_size, log->l_iclog_bak, log->l_iclog_size, log->l_iclog_size,
log->l_iclog_bufs); log->l_iclog_bufs);
kdb_printf("l_iclog_hsize %d l_iclog_heads %d\n", kdb_printf("l_stripemask %d l_iclog_hsize %d l_iclog_heads %d\n",
log->l_iclog_hsize, log->l_iclog_heads); log->l_stripemask, log->l_iclog_hsize, log->l_iclog_heads);
kdb_printf("l_sectbb_log %u l_sectbb_mask %u\n",
log->l_sectbb_log, log->l_sectbb_mask);
kdb_printf("&grant_lock: 0x%p resHeadQ: 0x%p wrHeadQ: 0x%p\n", kdb_printf("&grant_lock: 0x%p resHeadQ: 0x%p wrHeadQ: 0x%p\n",
&log->l_grant_lock, log->l_reserve_headq, log->l_write_headq); &log->l_grant_lock, log->l_reserve_headq, log->l_write_headq);
kdb_printf("GResCycle: %d GResBytes: %d GWrCycle: %d GWrBytes: %d\n", kdb_printf("GResCycle: %d GResBytes: %d GWrCycle: %d GWrBytes: %d\n",
...@@ -4712,7 +4714,6 @@ xfsidbg_xmount(xfs_mount_t *mp) ...@@ -4712,7 +4714,6 @@ xfsidbg_xmount(xfs_mount_t *mp)
(xfs_dfiloff_t)mp->m_dirfreeblk); (xfs_dfiloff_t)mp->m_dirfreeblk);
kdb_printf("chsize %d chash 0x%p\n", kdb_printf("chsize %d chash 0x%p\n",
mp->m_chsize, mp->m_chash); mp->m_chsize, mp->m_chash);
kdb_printf("m_lstripemask %d\n", mp->m_lstripemask);
kdb_printf("m_frozen %d m_active_trans %d\n", kdb_printf("m_frozen %d m_active_trans %d\n",
mp->m_frozen, mp->m_active_trans.counter); mp->m_frozen, mp->m_active_trans.counter);
if (mp->m_fsname != NULL) if (mp->m_fsname != NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment