aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log_priv.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2010-12-20 20:29:01 -0500
committerDave Chinner <david@fromorbit.com>2010-12-20 20:29:01 -0500
commit3f16b9850743b702380f098ab5e0308cd6af1792 (patch)
tree6a39db2c6b750fab92e16865383f733e48aa96ed /fs/xfs/xfs_log_priv.h
parentc8a09ff8ca2235bccdaea8a52fbd5349646a8ba4 (diff)
xfs: introduce new locks for the log grant ticket wait queues
The log grant ticket wait queues are currently protected by the log grant lock. However, the queues are functionally independent from each other, and operations on them only require serialisation against other queue operations now that all of the other log variables they use are atomic values. Hence, we can make them independent of the grant lock by introducing new locks just to protect the lists operations. because the lists are independent, we can use a lock per list and ensure that reserve and write head queuing do not contend. To ensure forced shutdowns work correctly in conjunction with the new fast paths, ensure that we check whether the log has been shut down in the grant functions once we hold the relevant spin locks but before we go to sleep. This is needed to co-ordinate correctly with the wakeups that are issued on the ticket queues so we don't leave any processes sleeping on the queues during a shutdown. 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.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index 7619d6a02388..befb2fc5b027 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -512,10 +512,6 @@ typedef struct log {
512 512
513 /* The following block of fields are changed while holding grant_lock */ 513 /* The following block of fields are changed while holding grant_lock */
514 spinlock_t l_grant_lock ____cacheline_aligned_in_smp; 514 spinlock_t l_grant_lock ____cacheline_aligned_in_smp;
515 struct list_head l_reserveq;
516 struct list_head l_writeq;
517 atomic64_t l_grant_reserve_head;
518 atomic64_t l_grant_write_head;
519 515
520 /* 516 /*
521 * l_last_sync_lsn and l_tail_lsn are atomics so they can be set and 517 * l_last_sync_lsn and l_tail_lsn are atomics so they can be set and
@@ -528,6 +524,18 @@ typedef struct log {
528 /* lsn of 1st LR with unflushed * buffers */ 524 /* lsn of 1st LR with unflushed * buffers */
529 atomic64_t l_tail_lsn ____cacheline_aligned_in_smp; 525 atomic64_t l_tail_lsn ____cacheline_aligned_in_smp;
530 526
527 /*
528 * ticket grant locks, queues and accounting have their own cachlines
529 * as these are quite hot and can be operated on concurrently.
530 */
531 spinlock_t l_grant_reserve_lock ____cacheline_aligned_in_smp;
532 struct list_head l_reserveq;
533 atomic64_t l_grant_reserve_head;
534
535 spinlock_t l_grant_write_lock ____cacheline_aligned_in_smp;
536 struct list_head l_writeq;
537 atomic64_t l_grant_write_head;
538
531 /* The following field are used for debugging; need to hold icloglock */ 539 /* The following field are used for debugging; need to hold icloglock */
532#ifdef DEBUG 540#ifdef DEBUG
533 char *l_iclog_bak[XLOG_MAX_ICLOGS]; 541 char *l_iclog_bak[XLOG_MAX_ICLOGS];