diff options
author | Theodore Ts'o <tytso@mit.edu> | 2010-08-03 21:35:12 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-08-03 21:35:12 -0400 |
commit | a931da6ac9331a6c80dd91c199105806f2336188 (patch) | |
tree | 2d4ea766def9a98d21c2379f41e796b0e57ccd6b /fs/ext4 | |
parent | a51dca9cd3bb4ec5a05bfb6feabf024a5c808a37 (diff) |
jbd2: Change j_state_lock to be a rwlock_t
Lockstat reports have shown that j_state_lock is a major source of
lock contention, especially on systems with more than 4 CPU cores. So
change it to be a read/write spinlock.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/inode.c | 4 | ||||
-rw-r--r-- | fs/ext4/super.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 533b607f9cb5..ab2247d642c6 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -5066,7 +5066,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) | |||
5066 | transaction_t *transaction; | 5066 | transaction_t *transaction; |
5067 | tid_t tid; | 5067 | tid_t tid; |
5068 | 5068 | ||
5069 | spin_lock(&journal->j_state_lock); | 5069 | read_lock(&journal->j_state_lock); |
5070 | if (journal->j_running_transaction) | 5070 | if (journal->j_running_transaction) |
5071 | transaction = journal->j_running_transaction; | 5071 | transaction = journal->j_running_transaction; |
5072 | else | 5072 | else |
@@ -5075,7 +5075,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) | |||
5075 | tid = transaction->t_tid; | 5075 | tid = transaction->t_tid; |
5076 | else | 5076 | else |
5077 | tid = journal->j_commit_sequence; | 5077 | tid = journal->j_commit_sequence; |
5078 | spin_unlock(&journal->j_state_lock); | 5078 | read_unlock(&journal->j_state_lock); |
5079 | ei->i_sync_tid = tid; | 5079 | ei->i_sync_tid = tid; |
5080 | ei->i_datasync_tid = tid; | 5080 | ei->i_datasync_tid = tid; |
5081 | } | 5081 | } |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 3fd65eb66ccd..81cb3fc1218e 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -3232,7 +3232,7 @@ static void ext4_init_journal_params(struct super_block *sb, journal_t *journal) | |||
3232 | journal->j_min_batch_time = sbi->s_min_batch_time; | 3232 | journal->j_min_batch_time = sbi->s_min_batch_time; |
3233 | journal->j_max_batch_time = sbi->s_max_batch_time; | 3233 | journal->j_max_batch_time = sbi->s_max_batch_time; |
3234 | 3234 | ||
3235 | spin_lock(&journal->j_state_lock); | 3235 | write_lock(&journal->j_state_lock); |
3236 | if (test_opt(sb, BARRIER)) | 3236 | if (test_opt(sb, BARRIER)) |
3237 | journal->j_flags |= JBD2_BARRIER; | 3237 | journal->j_flags |= JBD2_BARRIER; |
3238 | else | 3238 | else |
@@ -3241,7 +3241,7 @@ static void ext4_init_journal_params(struct super_block *sb, journal_t *journal) | |||
3241 | journal->j_flags |= JBD2_ABORT_ON_SYNCDATA_ERR; | 3241 | journal->j_flags |= JBD2_ABORT_ON_SYNCDATA_ERR; |
3242 | else | 3242 | else |
3243 | journal->j_flags &= ~JBD2_ABORT_ON_SYNCDATA_ERR; | 3243 | journal->j_flags &= ~JBD2_ABORT_ON_SYNCDATA_ERR; |
3244 | spin_unlock(&journal->j_state_lock); | 3244 | write_unlock(&journal->j_state_lock); |
3245 | } | 3245 | } |
3246 | 3246 | ||
3247 | static journal_t *ext4_get_journal(struct super_block *sb, | 3247 | static journal_t *ext4_get_journal(struct super_block *sb, |