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,
xfs_daddr_t blk_offset,
int num_bblks)
{
xlog_t *log;
if (!(mp->m_flags & XFS_MOUNT_NORECOVERY))
cmn_err(CE_NOTE, "XFS mounting filesystem %s", mp->m_fsname);
else {
......@@ -508,7 +506,7 @@ xfs_log_mount(xfs_mount_t *mp,
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 (! xlog_debug) {
......@@ -528,19 +526,19 @@ xfs_log_mount(xfs_mount_t *mp,
if (readonly)
vfsp->vfs_flag &= ~VFS_RDONLY;
error = xlog_recover(log, readonly);
error = xlog_recover(mp->m_log, readonly);
if (readonly)
vfsp->vfs_flag |= VFS_RDONLY;
if (error) {
cmn_err(CE_WARN, "XFS: log mount/recovery failed");
xlog_unalloc_log(log);
xlog_unalloc_log(mp->m_log);
return error;
}
}
/* 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 */
return 0;
......@@ -1191,7 +1189,7 @@ xlog_alloc_log(xfs_mount_t *mp,
int i;
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_dev = log_dev;
......@@ -1203,12 +1201,20 @@ xlog_alloc_log(xfs_mount_t *mp,
log->l_prev_block = -1;
ASSIGN_ANY_LSN(log->l_tail_lsn, 1, 0, ARCH_NOCONVERT);
/* log->l_tail_lsn = 0x100000000LL; cycle = 1; current block = 0 */
/* log->l_tail_lsn = 0x100000000LL; cycle = 1; current block = 0 */
log->l_last_sync_lsn = log->l_tail_lsn;
log->l_curr_cycle = 1; /* 0 is bad since this is initial value */
log->l_grant_reserve_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)) {
log->l_sectbb_log = mp->m_sb.sb_logsectlog - BBSHIFT;
ASSERT(log->l_sectbb_log <= mp->m_sectbb_log);
......@@ -2814,10 +2820,9 @@ xlog_state_switch_iclogs(xlog_t *log,
/* Round up to next log-sunit */
if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) {
if (log->l_curr_block & (log->l_mp->m_lstripemask - 1)) {
roundup = log->l_mp->m_lstripemask -
(log->l_curr_block &
(log->l_mp->m_lstripemask - 1));
if (log->l_curr_block & (log->l_stripemask - 1)) {
roundup = log->l_stripemask -
(log->l_curr_block & (log->l_stripemask - 1));
} else {
roundup = 0;
}
......
......@@ -533,6 +533,7 @@ typedef struct log {
uint l_flags;
uint l_quotaoffs_flag;/* XFS_DQ_*, if QUOTAOFFs found */
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_heads; /* number of iclog header sectors */
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)
mp->m_blockwmask = mp->m_blockwsize - 1;
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.
* This value is for inodes getting attributes for the first time,
......
......@@ -68,6 +68,7 @@ typedef struct xfs_trans_reservations {
((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks))
#else
struct cred;
struct log;
struct vfs;
struct vnode;
struct xfs_mount_args;
......@@ -303,7 +304,7 @@ typedef struct xfs_mount {
uint m_readio_blocks; /* min read size blocks */
uint m_writeio_log; /* min write size log bytes */
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_logbsize; /* size of each log buffer */
uint m_rsumlevels; /* rt summary levels */
......@@ -358,7 +359,6 @@ typedef struct xfs_mount {
#endif
int m_dalign; /* stripe unit */
int m_swidth; /* stripe width */
int m_lstripemask; /* log stripe mask */
int m_sinoalign; /* stripe unit inode alignmnt */
int m_attr_magicpct;/* 37% of the blocksize */
int m_dir_magicpct; /* 37% of the dir blocksize */
......
......@@ -4269,8 +4269,10 @@ xfsidbg_xlog(xlog_t *log)
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_bufs);
kdb_printf("l_iclog_hsize %d l_iclog_heads %d\n",
log->l_iclog_hsize, log->l_iclog_heads);
kdb_printf("l_stripemask %d l_iclog_hsize %d l_iclog_heads %d\n",
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",
&log->l_grant_lock, log->l_reserve_headq, log->l_write_headq);
kdb_printf("GResCycle: %d GResBytes: %d GWrCycle: %d GWrBytes: %d\n",
......@@ -4712,7 +4714,6 @@ xfsidbg_xmount(xfs_mount_t *mp)
(xfs_dfiloff_t)mp->m_dirfreeblk);
kdb_printf("chsize %d chash 0x%p\n",
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",
mp->m_frozen, mp->m_active_trans.counter);
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