aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Chinner <david@fromorbit.com>2008-10-30 02:39:12 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 02:39:12 -0400
commit7b2e2a31f5c23b5f028af8c895137b4c512cc1c8 (patch)
treec37aa7117a16ebcd01d0ac2687b944e5dd8a7361
parent5b00f14fbd60d42441f78c0e414a539cbfba5cb9 (diff)
[XFS] Allow 64 bit machines to avoid the AIL lock during flushes
When copying lsn's from the log item to the inode or dquot flush lsn, we currently grab the AIL lock. We do this because the LSN is a 64 bit quantity and it needs to be read atomically. The lock is used to guarantee atomicity for 32 bit platforms. Make the LSN copying a small function, and make the function used conditional on BITS_PER_LONG so that 64 bit machines don't need to take the AIL lock in these places. SGI-PV: 988143 SGI-Modid: xfs-linux-melb:xfs-kern:32349a Signed-off-by: David Chinner <david@fromorbit.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com> Signed-off-by: Christoph Hellwig <hch@infradead.org>
-rw-r--r--fs/xfs/quota/xfs_dquot.c6
-rw-r--r--fs/xfs/xfs_inode.c17
-rw-r--r--fs/xfs/xfs_trans_priv.h23
3 files changed, 32 insertions, 14 deletions
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c
index 1e6bf3925645..59c1081412ec 100644
--- a/fs/xfs/quota/xfs_dquot.c
+++ b/fs/xfs/quota/xfs_dquot.c
@@ -1272,10 +1272,8 @@ xfs_qm_dqflush(
1272 dqp->dq_flags &= ~(XFS_DQ_DIRTY); 1272 dqp->dq_flags &= ~(XFS_DQ_DIRTY);
1273 mp = dqp->q_mount; 1273 mp = dqp->q_mount;
1274 1274
1275 /* lsn is 64 bits */ 1275 xfs_trans_ail_copy_lsn(mp->m_ail, &dqp->q_logitem.qli_flush_lsn,
1276 spin_lock(&mp->m_ail_lock); 1276 &dqp->q_logitem.qli_item.li_lsn);
1277 dqp->q_logitem.qli_flush_lsn = dqp->q_logitem.qli_item.li_lsn;
1278 spin_unlock(&mp->m_ail_lock);
1279 1277
1280 /* 1278 /*
1281 * Attach an iodone routine so that we can remove this dquot from the 1279 * Attach an iodone routine so that we can remove this dquot from the
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 4eb629f0513e..2951ffd83066 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2214,9 +2214,9 @@ xfs_ifree_cluster(
2214 iip = (xfs_inode_log_item_t *)lip; 2214 iip = (xfs_inode_log_item_t *)lip;
2215 ASSERT(iip->ili_logged == 1); 2215 ASSERT(iip->ili_logged == 1);
2216 lip->li_cb = (void(*)(xfs_buf_t*,xfs_log_item_t*)) xfs_istale_done; 2216 lip->li_cb = (void(*)(xfs_buf_t*,xfs_log_item_t*)) xfs_istale_done;
2217 spin_lock(&mp->m_ail_lock); 2217 xfs_trans_ail_copy_lsn(mp->m_ail,
2218 iip->ili_flush_lsn = iip->ili_item.li_lsn; 2218 &iip->ili_flush_lsn,
2219 spin_unlock(&mp->m_ail_lock); 2219 &iip->ili_item.li_lsn);
2220 xfs_iflags_set(iip->ili_inode, XFS_ISTALE); 2220 xfs_iflags_set(iip->ili_inode, XFS_ISTALE);
2221 pre_flushed++; 2221 pre_flushed++;
2222 } 2222 }
@@ -2237,9 +2237,8 @@ xfs_ifree_cluster(
2237 iip->ili_last_fields = iip->ili_format.ilf_fields; 2237 iip->ili_last_fields = iip->ili_format.ilf_fields;
2238 iip->ili_format.ilf_fields = 0; 2238 iip->ili_format.ilf_fields = 0;
2239 iip->ili_logged = 1; 2239 iip->ili_logged = 1;
2240 spin_lock(&mp->m_ail_lock); 2240 xfs_trans_ail_copy_lsn(mp->m_ail, &iip->ili_flush_lsn,
2241 iip->ili_flush_lsn = iip->ili_item.li_lsn; 2241 &iip->ili_item.li_lsn);
2242 spin_unlock(&mp->m_ail_lock);
2243 2242
2244 xfs_buf_attach_iodone(bp, 2243 xfs_buf_attach_iodone(bp,
2245 (void(*)(xfs_buf_t*,xfs_log_item_t*)) 2244 (void(*)(xfs_buf_t*,xfs_log_item_t*))
@@ -3476,10 +3475,8 @@ xfs_iflush_int(
3476 iip->ili_format.ilf_fields = 0; 3475 iip->ili_format.ilf_fields = 0;
3477 iip->ili_logged = 1; 3476 iip->ili_logged = 1;
3478 3477
3479 ASSERT(sizeof(xfs_lsn_t) == 8); /* don't lock if it shrinks */ 3478 xfs_trans_ail_copy_lsn(mp->m_ail, &iip->ili_flush_lsn,
3480 spin_lock(&mp->m_ail_lock); 3479 &iip->ili_item.li_lsn);
3481 iip->ili_flush_lsn = iip->ili_item.li_lsn;
3482 spin_unlock(&mp->m_ail_lock);
3483 3480
3484 /* 3481 /*
3485 * Attach the function xfs_iflush_done to the inode's 3482 * Attach the function xfs_iflush_done to the inode's
diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h
index aa5853502529..708cff72d209 100644
--- a/fs/xfs/xfs_trans_priv.h
+++ b/fs/xfs/xfs_trans_priv.h
@@ -106,4 +106,27 @@ void xfsaild_wakeup(struct xfs_ail *, xfs_lsn_t);
106int xfsaild_start(struct xfs_ail *); 106int xfsaild_start(struct xfs_ail *);
107void xfsaild_stop(struct xfs_ail *); 107void xfsaild_stop(struct xfs_ail *);
108 108
109#if BITS_PER_LONG != 64
110static inline void
111xfs_trans_ail_copy_lsn(
112 struct xfs_ail *ailp,
113 xfs_lsn_t *dst,
114 xfs_lsn_t *src)
115{
116 ASSERT(sizeof(xfs_lsn_t) == 8); /* don't lock if it shrinks */
117 spin_lock(&ailp->xa_mount->m_ail_lock);
118 *dst = *src;
119 spin_unlock(&ailp->xa_mount->m_ail_lock);
120}
121#else
122static inline void
123xfs_trans_ail_copy_lsn(
124 struct xfs_ail *ailp,
125 xfs_lsn_t *dst,
126 xfs_lsn_t *src)
127{
128 ASSERT(sizeof(xfs_lsn_t) == 8);
129 *dst = *src;
130}
131#endif
109#endif /* __XFS_TRANS_PRIV_H__ */ 132#endif /* __XFS_TRANS_PRIV_H__ */