lops.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 v.2.
  8. */
  9. #ifndef __LOPS_DOT_H__
  10. #define __LOPS_DOT_H__
  11. extern const struct gfs2_log_operations gfs2_glock_lops;
  12. extern const struct gfs2_log_operations gfs2_buf_lops;
  13. extern const struct gfs2_log_operations gfs2_revoke_lops;
  14. extern const struct gfs2_log_operations gfs2_rg_lops;
  15. extern const struct gfs2_log_operations gfs2_databuf_lops;
  16. extern const struct gfs2_log_operations *gfs2_log_ops[];
  17. static inline void lops_init_le(struct gfs2_log_element *le,
  18. const struct gfs2_log_operations *lops)
  19. {
  20. INIT_LIST_HEAD(&le->le_list);
  21. le->le_ops = lops;
  22. }
  23. static inline void lops_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
  24. {
  25. if (le->le_ops->lo_add)
  26. le->le_ops->lo_add(sdp, le);
  27. }
  28. static inline void lops_incore_commit(struct gfs2_sbd *sdp,
  29. struct gfs2_trans *tr)
  30. {
  31. int x;
  32. for (x = 0; gfs2_log_ops[x]; x++)
  33. if (gfs2_log_ops[x]->lo_incore_commit)
  34. gfs2_log_ops[x]->lo_incore_commit(sdp, tr);
  35. }
  36. static inline void lops_before_commit(struct gfs2_sbd *sdp)
  37. {
  38. int x;
  39. for (x = 0; gfs2_log_ops[x]; x++)
  40. if (gfs2_log_ops[x]->lo_before_commit)
  41. gfs2_log_ops[x]->lo_before_commit(sdp);
  42. }
  43. static inline void lops_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
  44. {
  45. int x;
  46. for (x = 0; gfs2_log_ops[x]; x++)
  47. if (gfs2_log_ops[x]->lo_after_commit)
  48. gfs2_log_ops[x]->lo_after_commit(sdp, ai);
  49. }
  50. static inline void lops_before_scan(struct gfs2_jdesc *jd,
  51. struct gfs2_log_header *head,
  52. unsigned int pass)
  53. {
  54. int x;
  55. for (x = 0; gfs2_log_ops[x]; x++)
  56. if (gfs2_log_ops[x]->lo_before_scan)
  57. gfs2_log_ops[x]->lo_before_scan(jd, head, pass);
  58. }
  59. static inline int lops_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
  60. struct gfs2_log_descriptor *ld,
  61. __be64 *ptr,
  62. unsigned int pass)
  63. {
  64. int x, error;
  65. for (x = 0; gfs2_log_ops[x]; x++)
  66. if (gfs2_log_ops[x]->lo_scan_elements) {
  67. error = gfs2_log_ops[x]->lo_scan_elements(jd, start,
  68. ld, ptr, pass);
  69. if (error)
  70. return error;
  71. }
  72. return 0;
  73. }
  74. static inline void lops_after_scan(struct gfs2_jdesc *jd, int error,
  75. unsigned int pass)
  76. {
  77. int x;
  78. for (x = 0; gfs2_log_ops[x]; x++)
  79. if (gfs2_log_ops[x]->lo_before_scan)
  80. gfs2_log_ops[x]->lo_after_scan(jd, error, pass);
  81. }
  82. #endif /* __LOPS_DOT_H__ */