| From d6734ca3a2e08b80dc0b3a2966a807cc7adbb45d Mon Sep 17 00:00:00 2001 |
| From: Steven Rostedt <rostedt@goodmis.org> |
| Date: Fri, 3 Jul 2009 08:29:55 -0500 |
| Subject: [PATCH] fs: jbd: replace bh_state lock |
| |
| commit c0dd527e0384535228a01f779dcf993df7d93e18 in tip. |
| |
| I was compiling a kernel in a shell that I set to a priority of 20, |
| and it locked up on the bit_spin_lock crap of jbd. |
| |
| This patch adds another spinlock to the buffer head and uses that |
| instead of the bit_spins. |
| |
| From: Steven Rostedt <rostedt@goodmis.org> |
| Signed-off-by: Ingo Molnar <mingo@elte.hu> |
| Signed-off-by: Thomas Gleixner <tglx@linutronix.de> |
| |
| -- |
| |
| fs/buffer.c | 3 ++- |
| include/linux/buffer_head.h | 1 + |
| include/linux/jbd.h | 12 ++++++------ |
| 3 files changed, 9 insertions(+), 7 deletions(-) |
| |
| diff --git a/fs/buffer.c b/fs/buffer.c |
| index 1a0363d..b34323c 100644 |
| --- a/fs/buffer.c |
| +++ b/fs/buffer.c |
| @@ -40,7 +40,6 @@ |
| #include <linux/cpu.h> |
| #include <linux/bitops.h> |
| #include <linux/mpage.h> |
| -#include <linux/bit_spinlock.h> |
| |
| static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); |
| |
| @@ -3263,6 +3262,7 @@ struct buffer_head *alloc_buffer_head(gfp_t gfp_flags) |
| if (ret) { |
| INIT_LIST_HEAD(&ret->b_assoc_buffers); |
| spin_lock_init(&ret->b_uptodate_lock); |
| + spin_lock_init(&ret->b_state_lock); |
| get_cpu_var(bh_accounting).nr++; |
| recalc_bh_state(); |
| put_cpu_var(bh_accounting); |
| @@ -3275,6 +3275,7 @@ void free_buffer_head(struct buffer_head *bh) |
| { |
| BUG_ON(!list_empty(&bh->b_assoc_buffers)); |
| BUG_ON(spin_is_locked(&bh->b_uptodate_lock)); |
| + BUG_ON(spin_is_locked(&bh->b_state_lock)); |
| kmem_cache_free(bh_cachep, bh); |
| get_cpu_var(bh_accounting).nr--; |
| recalc_bh_state(); |
| diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h |
| index cc6a758..a7a7491 100644 |
| --- a/include/linux/buffer_head.h |
| +++ b/include/linux/buffer_head.h |
| @@ -71,6 +71,7 @@ struct buffer_head { |
| associated with */ |
| atomic_t b_count; /* users using this buffer_head */ |
| spinlock_t b_uptodate_lock; |
| + spinlock_t b_state_lock; |
| }; |
| |
| /* |
| diff --git a/include/linux/jbd.h b/include/linux/jbd.h |
| index 331530c..6cfd69e 100644 |
| --- a/include/linux/jbd.h |
| +++ b/include/linux/jbd.h |
| @@ -315,32 +315,32 @@ static inline struct journal_head *bh2jh(struct buffer_head *bh) |
| |
| static inline void jbd_lock_bh_state(struct buffer_head *bh) |
| { |
| - bit_spin_lock(BH_State, &bh->b_state); |
| + spin_lock(&bh->b_state_lock); |
| } |
| |
| static inline int jbd_trylock_bh_state(struct buffer_head *bh) |
| { |
| - return bit_spin_trylock(BH_State, &bh->b_state); |
| + return spin_trylock(&bh->b_state_lock); |
| } |
| |
| static inline int jbd_is_locked_bh_state(struct buffer_head *bh) |
| { |
| - return bit_spin_is_locked(BH_State, &bh->b_state); |
| + return spin_is_locked(&bh->b_state_lock); |
| } |
| |
| static inline void jbd_unlock_bh_state(struct buffer_head *bh) |
| { |
| - bit_spin_unlock(BH_State, &bh->b_state); |
| + spin_unlock(&bh->b_state_lock); |
| } |
| |
| static inline void jbd_lock_bh_journal_head(struct buffer_head *bh) |
| { |
| - bit_spin_lock(BH_JournalHead, &bh->b_state); |
| + spin_lock_irq(&bh->b_uptodate_lock); |
| } |
| |
| static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh) |
| { |
| - bit_spin_unlock(BH_JournalHead, &bh->b_state); |
| + spin_unlock_irq(&bh->b_uptodate_lock); |
| } |
| |
| struct jbd_revoke_table_s; |
| -- |
| 1.7.1.1 |
| |