Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * include/linux/journal-head.h |
| 3 | * |
| 4 | * buffer_head fields for JBD |
| 5 | * |
Francois Cami | e1f8e87 | 2008-10-15 22:01:59 -0700 | [diff] [blame] | 6 | * 27 May 2001 Andrew Morton |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * Created - pulled out of fs.h |
| 8 | */ |
| 9 | |
| 10 | #ifndef JOURNAL_HEAD_H_INCLUDED |
| 11 | #define JOURNAL_HEAD_H_INCLUDED |
| 12 | |
| 13 | typedef unsigned int tid_t; /* Unique transaction ID */ |
| 14 | typedef struct transaction_s transaction_t; /* Compound transaction type */ |
Joel Becker | e06c822 | 2008-09-11 15:35:47 -0700 | [diff] [blame] | 15 | |
| 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | struct buffer_head; |
| 18 | |
| 19 | struct 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()] |
Jan Kara | e2555fd | 2013-05-13 09:45:01 -0400 | [diff] [blame] | 33 | * NOTE: We *cannot* combine this with b_modified into a bitfield |
| 34 | * as gcc would then (which the C standard allows but which is |
| 35 | * very unuseful) make 64-bit accesses to the bitfield and clobber |
| 36 | * b_jcount if its update races with bitfield modification. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | */ |
Jan Kara | e2555fd | 2013-05-13 09:45:01 -0400 | [diff] [blame] | 38 | unsigned b_jlist; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* |
| 41 | * This flag signals the buffer has been modified by |
| 42 | * the currently running transaction |
| 43 | * [jbd_lock_bh_state()] |
| 44 | */ |
Jan Kara | e2555fd | 2013-05-13 09:45:01 -0400 | [diff] [blame] | 45 | unsigned b_modified; |
Amir Goldstein | c2cc702 | 2011-03-20 20:08:48 -0400 | [diff] [blame] | 46 | |
| 47 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | * Copy of the buffer data frozen for writing to the log. |
| 49 | * [jbd_lock_bh_state()] |
| 50 | */ |
| 51 | char *b_frozen_data; |
| 52 | |
| 53 | /* |
| 54 | * Pointer to a saved copy of the buffer containing no uncommitted |
| 55 | * deallocation references, so that allocations can avoid overwriting |
| 56 | * uncommitted deletes. [jbd_lock_bh_state()] |
| 57 | */ |
| 58 | char *b_committed_data; |
| 59 | |
| 60 | /* |
| 61 | * Pointer to the compound transaction which owns this buffer's |
| 62 | * metadata: either the running transaction or the committing |
| 63 | * transaction (if there is one). Only applies to buffers on a |
| 64 | * transaction's data or metadata journaling list. |
| 65 | * [j_list_lock] [jbd_lock_bh_state()] |
Jan Kara | 932bb30 | 2012-03-13 22:45:25 -0400 | [diff] [blame] | 66 | * Either of these locks is enough for reading, both are needed for |
| 67 | * changes. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | */ |
| 69 | transaction_t *b_transaction; |
| 70 | |
| 71 | /* |
| 72 | * Pointer to the running compound transaction which is currently |
| 73 | * modifying the buffer's metadata, if there was already a transaction |
| 74 | * committing it when the new transaction touched it. |
| 75 | * [t_list_lock] [jbd_lock_bh_state()] |
| 76 | */ |
| 77 | transaction_t *b_next_transaction; |
| 78 | |
| 79 | /* |
| 80 | * Doubly-linked list of buffers on a transaction's data, metadata or |
| 81 | * forget queue. [t_list_lock] [jbd_lock_bh_state()] |
| 82 | */ |
| 83 | struct journal_head *b_tnext, *b_tprev; |
| 84 | |
| 85 | /* |
| 86 | * Pointer to the compound transaction against which this buffer |
| 87 | * is checkpointed. Only dirty buffers can be checkpointed. |
| 88 | * [j_list_lock] |
| 89 | */ |
| 90 | transaction_t *b_cp_transaction; |
| 91 | |
| 92 | /* |
| 93 | * Doubly-linked list of buffers still remaining to be flushed |
| 94 | * before an old transaction can be checkpointed. |
| 95 | * [j_list_lock] |
| 96 | */ |
| 97 | struct journal_head *b_cpnext, *b_cpprev; |
Joel Becker | e06c822 | 2008-09-11 15:35:47 -0700 | [diff] [blame] | 98 | |
| 99 | /* Trigger type */ |
| 100 | struct jbd2_buffer_trigger_type *b_triggers; |
| 101 | |
| 102 | /* Trigger type for the committing transaction's frozen data */ |
| 103 | struct jbd2_buffer_trigger_type *b_frozen_triggers; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | #endif /* JOURNAL_HEAD_H_INCLUDED */ |