journal-head.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * include/linux/journal-head.h
  3. *
  4. * buffer_head fields for JBD
  5. *
  6. * 27 May 2001 Andrew Morton
  7. * Created - pulled out of fs.h
  8. */
  9. #ifndef JOURNAL_HEAD_H_INCLUDED
  10. #define JOURNAL_HEAD_H_INCLUDED
  11. typedef unsigned int tid_t; /* Unique transaction ID */
  12. typedef struct transaction_s transaction_t; /* Compound transaction type */
  13. struct buffer_head;
  14. struct journal_head {
  15. /*
  16. * Points back to our buffer_head. [jbd_lock_bh_journal_head()]
  17. */
  18. struct buffer_head *b_bh;
  19. /*
  20. * Reference count - see description in journal.c
  21. * [jbd_lock_bh_journal_head()]
  22. */
  23. int b_jcount;
  24. /*
  25. * Journalling list for this buffer [jbd_lock_bh_state()]
  26. * NOTE: We *cannot* combine this with b_modified into a bitfield
  27. * as gcc would then (which the C standard allows but which is
  28. * very unuseful) make 64-bit accesses to the bitfield and clobber
  29. * b_jcount if its update races with bitfield modification.
  30. */
  31. unsigned b_jlist;
  32. /*
  33. * This flag signals the buffer has been modified by
  34. * the currently running transaction
  35. * [jbd_lock_bh_state()]
  36. */
  37. unsigned b_modified;
  38. /*
  39. * Copy of the buffer data frozen for writing to the log.
  40. * [jbd_lock_bh_state()]
  41. */
  42. char *b_frozen_data;
  43. /*
  44. * Pointer to a saved copy of the buffer containing no uncommitted
  45. * deallocation references, so that allocations can avoid overwriting
  46. * uncommitted deletes. [jbd_lock_bh_state()]
  47. */
  48. char *b_committed_data;
  49. /*
  50. * Pointer to the compound transaction which owns this buffer's
  51. * metadata: either the running transaction or the committing
  52. * transaction (if there is one). Only applies to buffers on a
  53. * transaction's data or metadata journaling list.
  54. * [j_list_lock] [jbd_lock_bh_state()]
  55. * Either of these locks is enough for reading, both are needed for
  56. * changes.
  57. */
  58. transaction_t *b_transaction;
  59. /*
  60. * Pointer to the running compound transaction which is currently
  61. * modifying the buffer's metadata, if there was already a transaction
  62. * committing it when the new transaction touched it.
  63. * [t_list_lock] [jbd_lock_bh_state()]
  64. */
  65. transaction_t *b_next_transaction;
  66. /*
  67. * Doubly-linked list of buffers on a transaction's data, metadata or
  68. * forget queue. [t_list_lock] [jbd_lock_bh_state()]
  69. */
  70. struct journal_head *b_tnext, *b_tprev;
  71. /*
  72. * Pointer to the compound transaction against which this buffer
  73. * is checkpointed. Only dirty buffers can be checkpointed.
  74. * [j_list_lock]
  75. */
  76. transaction_t *b_cp_transaction;
  77. /*
  78. * Doubly-linked list of buffers still remaining to be flushed
  79. * before an old transaction can be checkpointed.
  80. * [j_list_lock]
  81. */
  82. struct journal_head *b_cpnext, *b_cpprev;
  83. /* Trigger type */
  84. struct jbd2_buffer_trigger_type *b_triggers;
  85. /* Trigger type for the committing transaction's frozen data */
  86. struct jbd2_buffer_trigger_type *b_frozen_triggers;
  87. };
  88. #endif /* JOURNAL_HEAD_H_INCLUDED */