Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / include / linux / jbd_common.h
1 #ifndef _LINUX_JBD_STATE_H
2 #define _LINUX_JBD_STATE_H
3
4 #include <linux/bit_spinlock.h>
5
6 static inline struct buffer_head *jh2bh(struct journal_head *jh)
7 {
8         return jh->b_bh;
9 }
10
11 static inline struct journal_head *bh2jh(struct buffer_head *bh)
12 {
13         return bh->b_private;
14 }
15
16 static inline void jbd_lock_bh_state(struct buffer_head *bh)
17 {
18 #ifndef CONFIG_PREEMPT_RT_BASE
19         bit_spin_lock(BH_State, &bh->b_state);
20 #else
21         spin_lock(&bh->b_state_lock);
22 #endif
23 }
24
25 static inline int jbd_trylock_bh_state(struct buffer_head *bh)
26 {
27 #ifndef CONFIG_PREEMPT_RT_BASE
28         return bit_spin_trylock(BH_State, &bh->b_state);
29 #else
30         return spin_trylock(&bh->b_state_lock);
31 #endif
32 }
33
34 static inline int jbd_is_locked_bh_state(struct buffer_head *bh)
35 {
36 #ifndef CONFIG_PREEMPT_RT_BASE
37         return bit_spin_is_locked(BH_State, &bh->b_state);
38 #else
39         return spin_is_locked(&bh->b_state_lock);
40 #endif
41 }
42
43 static inline void jbd_unlock_bh_state(struct buffer_head *bh)
44 {
45 #ifndef CONFIG_PREEMPT_RT_BASE
46         bit_spin_unlock(BH_State, &bh->b_state);
47 #else
48         spin_unlock(&bh->b_state_lock);
49 #endif
50 }
51
52 static inline void jbd_lock_bh_journal_head(struct buffer_head *bh)
53 {
54 #ifndef CONFIG_PREEMPT_RT_BASE
55         bit_spin_lock(BH_JournalHead, &bh->b_state);
56 #else
57         spin_lock(&bh->b_journal_head_lock);
58 #endif
59 }
60
61 static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
62 {
63 #ifndef CONFIG_PREEMPT_RT_BASE
64         bit_spin_unlock(BH_JournalHead, &bh->b_state);
65 #else
66         spin_unlock(&bh->b_journal_head_lock);
67 #endif
68 }
69
70 #endif