[PATCH 30/34] xfs: convert l_tail_lsn to an atomic variable.
Christoph Hellwig
hch at infradead.org
Wed Dec 29 06:52:22 CST 2010
On Tue, Dec 21, 2010 at 06:29:26PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner at redhat.com>
>
> log->l_tail_lsn is currently protected by the log grant lock. The
> lock is only needed for serialising readers against writers, so we
> don't really need the lock if we make the l_tail_lsn variable an
> atomic. Converting the l_tail_lsn variable to an atomic64_t means we
> can start to peel back the grant lock from various operations.
>
> Also, provide functions to safely crack an atomic LSN variable into
> it's component pieces and to recombined the components into an
> atomic variable. Use them where appropriate.
>
> This also removes the need for explicitly holding a spinlock to read
> the l_tail_lsn on 32 bit platforms.
>
> Signed-off-by: Dave Chinner <dchinner at redhat.com>
Looks good,
Reviewed-by: Christoph Hellwig <hch at lst.de>
> /* log->l_tail_lsn = 0x100000000LL; cycle = 1; current block = 0 */
> - log->l_tail_lsn = xlog_assign_lsn(1, 0);
> - atomic64_set(&log->l_last_sync_lsn, xlog_assign_lsn(1, 0));
> + xlog_assign_atomic_lsn(&log->l_tail_lsn, 1, 0);
> + xlog_assign_atomic_lsn(&log->l_last_sync_lsn, 1, 0);
It might be worth to remove the rather pointless comment above.
> BTOBB(XLOG_MAX_ICLOGS << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \
> XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
>
> -
> static inline xfs_lsn_t xlog_assign_lsn(uint cycle, uint block)
spurious whitespace change
More information about the xfs
mailing list