xfs
[Top] [All Lists]

Re: [PATCH 30/34] xfs: convert l_tail_lsn to an atomic variable.

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 30/34] xfs: convert l_tail_lsn to an atomic variable.
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Wed, 29 Dec 2010 07:52:22 -0500
Cc: xfs@xxxxxxxxxxx
In-reply-to: <1292916570-25015-31-git-send-email-david@xxxxxxxxxxxxx>
References: <1292916570-25015-1-git-send-email-david@xxxxxxxxxxxxx> <1292916570-25015-31-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Tue, Dec 21, 2010 at 06:29:26PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>

Looks good,


Reviewed-by: Christoph Hellwig <hch@xxxxxx>

>       /* 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

<Prev in Thread] Current Thread [Next in Thread>