journal-head.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. */
  27. unsigned b_jlist;
  28. /*
  29. * This flag signals the buffer has been modified by
  30. * the currently running transaction
  31. * [jbd_lock_bh_state()]
  32. */
  33. unsigned b_modified;
  34. /*
  35. * This feild tracks the last transaction id in which this buffer
  36. * has been cowed
  37. * [jbd_lock_bh_state()]
  38. */
  39. tid_t b_cow_tid;
  40. /*
  41. * Copy of the buffer data frozen for writing to the log.
  42. * [jbd_lock_bh_state()]
  43. */
  44. char *b_frozen_data;
  45. /*
  46. * Pointer to a saved copy of the buffer containing no uncommitted
  47. * deallocation references, so that allocations can avoid overwriting
  48. * uncommitted deletes. [jbd_lock_bh_state()]
  49. */
  50. char *b_committed_data;
  51. /*
  52. * Pointer to the compound transaction which owns this buffer's
  53. * metadata: either the running transaction or the committing
  54. * transaction (if there is one). Only applies to buffers on a
  55. * transaction's data or metadata journaling list.
  56. * [j_list_lock] [jbd_lock_bh_state()]
  57. * Either of these locks is enough for reading, both are needed for
  58. * changes.
  59. */
  60. transaction_t *b_transaction;
  61. /*
  62. * Pointer to the running compound transaction which is currently
  63. * modifying the buffer's metadata, if there was already a transaction
  64. * committing it when the new transaction touched it.
  65. * [t_list_lock] [jbd_lock_bh_state()]
  66. */
  67. transaction_t *b_next_transaction;
  68. /*
  69. * Doubly-linked list of buffers on a transaction's data, metadata or
  70. * forget queue. [t_list_lock] [jbd_lock_bh_state()]
  71. */
  72. struct journal_head *b_tnext, *b_tprev;
  73. /*
  74. * Pointer to the compound transaction against which this buffer
  75. * is checkpointed. Only dirty buffers can be checkpointed.
  76. * [j_list_lock]
  77. */
  78. transaction_t *b_cp_transaction;
  79. /*
  80. * Doubly-linked list of buffers still remaining to be flushed
  81. * before an old transaction can be checkpointed.
  82. * [j_list_lock]
  83. */
  84. struct journal_head *b_cpnext, *b_cpprev;
  85. /* Trigger type */
  86. struct jbd2_buffer_trigger_type *b_triggers;
  87. /* Trigger type for the committing transaction's frozen data */
  88. struct jbd2_buffer_trigger_type *b_frozen_triggers;
  89. };
  90. #endif /* JOURNAL_HEAD_H_INCLUDED */