1 #ifndef _LINUX_JBD_STATE_H
2 #define _LINUX_JBD_STATE_H
4 #include <linux/bit_spinlock.h>
6 static inline struct buffer_head *jh2bh(struct journal_head *jh)
11 static inline struct journal_head *bh2jh(struct buffer_head *bh)
16 static inline void jbd_lock_bh_state(struct buffer_head *bh)
18 #ifndef CONFIG_PREEMPT_RT_BASE
19 bit_spin_lock(BH_State, &bh->b_state);
21 spin_lock(&bh->b_state_lock);
25 static inline int jbd_trylock_bh_state(struct buffer_head *bh)
27 #ifndef CONFIG_PREEMPT_RT_BASE
28 return bit_spin_trylock(BH_State, &bh->b_state);
30 return spin_trylock(&bh->b_state_lock);
34 static inline int jbd_is_locked_bh_state(struct buffer_head *bh)
36 #ifndef CONFIG_PREEMPT_RT_BASE
37 return bit_spin_is_locked(BH_State, &bh->b_state);
39 return spin_is_locked(&bh->b_state_lock);
43 static inline void jbd_unlock_bh_state(struct buffer_head *bh)
45 #ifndef CONFIG_PREEMPT_RT_BASE
46 bit_spin_unlock(BH_State, &bh->b_state);
48 spin_unlock(&bh->b_state_lock);
52 static inline void jbd_lock_bh_journal_head(struct buffer_head *bh)
54 #ifndef CONFIG_PREEMPT_RT_BASE
55 bit_spin_lock(BH_JournalHead, &bh->b_state);
57 spin_lock(&bh->b_journal_head_lock);
61 static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
63 #ifndef CONFIG_PREEMPT_RT_BASE
64 bit_spin_unlock(BH_JournalHead, &bh->b_state);
66 spin_unlock(&bh->b_journal_head_lock);