diff options
author | Dave Chinner <dchinner@redhat.com> | 2010-12-03 06:11:29 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2010-12-03 06:11:29 -0500 |
commit | 84f3c683c4d3f36d3c3ed320babd960a332ac458 (patch) | |
tree | 5884f4e5a04a7a67c634e003bfa590fd2e643fdc /fs/xfs/xfs_log_priv.h | |
parent | 2ced19cbae5448b720919a494606c62095d4f4db (diff) |
xfs: convert l_last_sync_lsn to an atomic variable
log->l_last_sync_lsn is updated in only one critical spot - log
buffer Io completion - and is protected by the grant lock here. This
requires the grant lock to be taken for every log buffer IO
completion. Converting the l_last_sync_lsn variable to an atomic64_t
means that we do not need to take the grant lock in log buffer IO
completion to update it.
This also removes the need for explicitly holding a spinlock to read
the l_last_sync_lsn on 32 bit platforms.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_log_priv.h')
-rw-r--r-- | fs/xfs/xfs_log_priv.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h index e2bb276eb2a7..958f356df10e 100644 --- a/fs/xfs/xfs_log_priv.h +++ b/fs/xfs/xfs_log_priv.h | |||
@@ -507,7 +507,6 @@ typedef struct log { | |||
507 | spinlock_t l_icloglock; /* grab to change iclog state */ | 507 | spinlock_t l_icloglock; /* grab to change iclog state */ |
508 | xfs_lsn_t l_tail_lsn; /* lsn of 1st LR with unflushed | 508 | xfs_lsn_t l_tail_lsn; /* lsn of 1st LR with unflushed |
509 | * buffers */ | 509 | * buffers */ |
510 | xfs_lsn_t l_last_sync_lsn;/* lsn of last LR on disk */ | ||
511 | int l_curr_cycle; /* Cycle number of log writes */ | 510 | int l_curr_cycle; /* Cycle number of log writes */ |
512 | int l_prev_cycle; /* Cycle number before last | 511 | int l_prev_cycle; /* Cycle number before last |
513 | * block increment */ | 512 | * block increment */ |
@@ -521,6 +520,14 @@ typedef struct log { | |||
521 | int64_t l_grant_reserve_head; | 520 | int64_t l_grant_reserve_head; |
522 | int64_t l_grant_write_head; | 521 | int64_t l_grant_write_head; |
523 | 522 | ||
523 | /* | ||
524 | * l_last_sync_lsn is an atomic so it can be set and read without | ||
525 | * needing to hold specific locks. To avoid operations contending with | ||
526 | * other hot objects, place it on a separate cacheline. | ||
527 | */ | ||
528 | /* lsn of last LR on disk */ | ||
529 | atomic64_t l_last_sync_lsn ____cacheline_aligned_in_smp; | ||
530 | |||
524 | /* The following field are used for debugging; need to hold icloglock */ | 531 | /* The following field are used for debugging; need to hold icloglock */ |
525 | #ifdef DEBUG | 532 | #ifdef DEBUG |
526 | char *l_iclog_bak[XLOG_MAX_ICLOGS]; | 533 | char *l_iclog_bak[XLOG_MAX_ICLOGS]; |