blob: 13a3da25ff0752a99bccb12b9c105cdbdae13457 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * include/linux/journal-head.h
3 *
4 * buffer_head fields for JBD
5 *
Francois Camie1f8e872008-10-15 22:01:59 -07006 * 27 May 2001 Andrew Morton
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 * Created - pulled out of fs.h
8 */
9
10#ifndef JOURNAL_HEAD_H_INCLUDED
11#define JOURNAL_HEAD_H_INCLUDED
12
13typedef unsigned int tid_t; /* Unique transaction ID */
14typedef struct transaction_s transaction_t; /* Compound transaction type */
Joel Beckere06c8222008-09-11 15:35:47 -070015
16
Linus Torvalds1da177e2005-04-16 15:20:36 -070017struct buffer_head;
18
19struct journal_head {
20 /*
21 * Points back to our buffer_head. [jbd_lock_bh_journal_head()]
22 */
23 struct buffer_head *b_bh;
24
25 /*
26 * Reference count - see description in journal.c
27 * [jbd_lock_bh_journal_head()]
28 */
29 int b_jcount;
30
31 /*
32 * Journalling list for this buffer [jbd_lock_bh_state()]
33 */
Jan Karaae4647f2013-04-12 00:03:42 -040034 unsigned b_jlist:4;
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
36 /*
37 * This flag signals the buffer has been modified by
38 * the currently running transaction
39 * [jbd_lock_bh_state()]
40 */
Jan Karaae4647f2013-04-12 00:03:42 -040041 unsigned b_modified:1;
Amir Goldsteinc2cc7022011-03-20 20:08:48 -040042
43 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 * Copy of the buffer data frozen for writing to the log.
45 * [jbd_lock_bh_state()]
46 */
47 char *b_frozen_data;
48
49 /*
50 * Pointer to a saved copy of the buffer containing no uncommitted
51 * deallocation references, so that allocations can avoid overwriting
52 * uncommitted deletes. [jbd_lock_bh_state()]
53 */
54 char *b_committed_data;
55
56 /*
57 * Pointer to the compound transaction which owns this buffer's
58 * metadata: either the running transaction or the committing
59 * transaction (if there is one). Only applies to buffers on a
60 * transaction's data or metadata journaling list.
61 * [j_list_lock] [jbd_lock_bh_state()]
Jan Kara932bb302012-03-13 22:45:25 -040062 * Either of these locks is enough for reading, both are needed for
63 * changes.
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 */
65 transaction_t *b_transaction;
66
67 /*
68 * Pointer to the running compound transaction which is currently
69 * modifying the buffer's metadata, if there was already a transaction
70 * committing it when the new transaction touched it.
71 * [t_list_lock] [jbd_lock_bh_state()]
72 */
73 transaction_t *b_next_transaction;
74
75 /*
76 * Doubly-linked list of buffers on a transaction's data, metadata or
77 * forget queue. [t_list_lock] [jbd_lock_bh_state()]
78 */
79 struct journal_head *b_tnext, *b_tprev;
80
81 /*
82 * Pointer to the compound transaction against which this buffer
83 * is checkpointed. Only dirty buffers can be checkpointed.
84 * [j_list_lock]
85 */
86 transaction_t *b_cp_transaction;
87
88 /*
89 * Doubly-linked list of buffers still remaining to be flushed
90 * before an old transaction can be checkpointed.
91 * [j_list_lock]
92 */
93 struct journal_head *b_cpnext, *b_cpprev;
Joel Beckere06c8222008-09-11 15:35:47 -070094
95 /* Trigger type */
96 struct jbd2_buffer_trigger_type *b_triggers;
97
98 /* Trigger type for the committing transaction's frozen data */
99 struct jbd2_buffer_trigger_type *b_frozen_triggers;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100};
101
102#endif /* JOURNAL_HEAD_H_INCLUDED */