jbd_common.h 974 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef _LINUX_JBD_STATE_H
  2. #define _LINUX_JBD_STATE_H
  3. #include <linux/bit_spinlock.h>
  4. static inline struct buffer_head *jh2bh(struct journal_head *jh)
  5. {
  6. return jh->b_bh;
  7. }
  8. static inline struct journal_head *bh2jh(struct buffer_head *bh)
  9. {
  10. return bh->b_private;
  11. }
  12. static inline void jbd_lock_bh_state(struct buffer_head *bh)
  13. {
  14. bit_spin_lock(BH_State, &bh->b_state);
  15. }
  16. static inline int jbd_trylock_bh_state(struct buffer_head *bh)
  17. {
  18. return bit_spin_trylock(BH_State, &bh->b_state);
  19. }
  20. static inline int jbd_is_locked_bh_state(struct buffer_head *bh)
  21. {
  22. return bit_spin_is_locked(BH_State, &bh->b_state);
  23. }
  24. static inline void jbd_unlock_bh_state(struct buffer_head *bh)
  25. {
  26. bit_spin_unlock(BH_State, &bh->b_state);
  27. }
  28. static inline void jbd_lock_bh_journal_head(struct buffer_head *bh)
  29. {
  30. bit_spin_lock(BH_JournalHead, &bh->b_state);
  31. }
  32. static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
  33. {
  34. bit_spin_unlock(BH_JournalHead, &bh->b_state);
  35. }
  36. #endif