log.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  3. * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
  4. *
  5. * This copyrighted material is made available to anyone wishing to use,
  6. * modify, copy, or redistribute it subject to the terms and conditions
  7. * of the GNU General Public License version 2.
  8. */
  9. #ifndef __LOG_DOT_H__
  10. #define __LOG_DOT_H__
  11. #include <linux/list.h>
  12. #include <linux/spinlock.h>
  13. #include <linux/writeback.h>
  14. #include "incore.h"
  15. #include "inode.h"
  16. /**
  17. * gfs2_log_lock - acquire the right to mess with the log manager
  18. * @sdp: the filesystem
  19. *
  20. */
  21. static inline void gfs2_log_lock(struct gfs2_sbd *sdp)
  22. __acquires(&sdp->sd_log_lock)
  23. {
  24. spin_lock(&sdp->sd_log_lock);
  25. }
  26. /**
  27. * gfs2_log_unlock - release the right to mess with the log manager
  28. * @sdp: the filesystem
  29. *
  30. */
  31. static inline void gfs2_log_unlock(struct gfs2_sbd *sdp)
  32. __releases(&sdp->sd_log_lock)
  33. {
  34. spin_unlock(&sdp->sd_log_lock);
  35. }
  36. static inline void gfs2_log_pointers_init(struct gfs2_sbd *sdp,
  37. unsigned int value)
  38. {
  39. if (++value == sdp->sd_jdesc->jd_blocks) {
  40. value = 0;
  41. }
  42. sdp->sd_log_head = sdp->sd_log_tail = value;
  43. }
  44. static inline void gfs2_ordered_add_inode(struct gfs2_inode *ip)
  45. {
  46. struct gfs2_sbd *sdp;
  47. if (!gfs2_is_ordered(ip))
  48. return;
  49. sdp = GFS2_SB(&ip->i_inode);
  50. if (!test_bit(GIF_ORDERED, &ip->i_flags)) {
  51. spin_lock(&sdp->sd_ordered_lock);
  52. if (!test_and_set_bit(GIF_ORDERED, &ip->i_flags))
  53. list_add(&ip->i_ordered, &sdp->sd_log_le_ordered);
  54. spin_unlock(&sdp->sd_ordered_lock);
  55. }
  56. }
  57. extern void gfs2_ordered_del_inode(struct gfs2_inode *ip);
  58. extern unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct,
  59. unsigned int ssize);
  60. extern void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks);
  61. extern int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks);
  62. extern void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
  63. u64 seq, u32 tail, u32 flags, int op_flags);
  64. extern void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl,
  65. u32 type);
  66. extern void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans);
  67. extern void gfs2_ail1_flush(struct gfs2_sbd *sdp, struct writeback_control *wbc);
  68. extern void gfs2_log_shutdown(struct gfs2_sbd *sdp);
  69. extern int gfs2_logd(void *data);
  70. extern void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd);
  71. extern void gfs2_glock_remove_revoke(struct gfs2_glock *gl);
  72. extern void gfs2_write_revokes(struct gfs2_sbd *sdp);
  73. #endif /* __LOG_DOT_H__ */