hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/include/linux/journal-head.h
....@@ -11,6 +11,8 @@
1111 #ifndef JOURNAL_HEAD_H_INCLUDED
1212 #define JOURNAL_HEAD_H_INCLUDED
1313
14
+#include <linux/spinlock.h>
15
+
1416 typedef unsigned int tid_t; /* Unique transaction ID */
1517 typedef struct transaction_s transaction_t; /* Compound transaction type */
1618
....@@ -24,13 +26,18 @@
2426 struct buffer_head *b_bh;
2527
2628 /*
29
+ * Protect the buffer head state
30
+ */
31
+ spinlock_t b_state_lock;
32
+
33
+ /*
2734 * Reference count - see description in journal.c
2835 * [jbd_lock_bh_journal_head()]
2936 */
3037 int b_jcount;
3138
3239 /*
33
- * Journalling list for this buffer [jbd_lock_bh_state()]
40
+ * Journalling list for this buffer [b_state_lock]
3441 * NOTE: We *cannot* combine this with b_modified into a bitfield
3542 * as gcc would then (which the C standard allows but which is
3643 * very unuseful) make 64-bit accesses to the bitfield and clobber
....@@ -41,20 +48,20 @@
4148 /*
4249 * This flag signals the buffer has been modified by
4350 * the currently running transaction
44
- * [jbd_lock_bh_state()]
51
+ * [b_state_lock]
4552 */
4653 unsigned b_modified;
4754
4855 /*
4956 * Copy of the buffer data frozen for writing to the log.
50
- * [jbd_lock_bh_state()]
57
+ * [b_state_lock]
5158 */
5259 char *b_frozen_data;
5360
5461 /*
5562 * Pointer to a saved copy of the buffer containing no uncommitted
5663 * deallocation references, so that allocations can avoid overwriting
57
- * uncommitted deletes. [jbd_lock_bh_state()]
64
+ * uncommitted deletes. [b_state_lock]
5865 */
5966 char *b_committed_data;
6067
....@@ -63,7 +70,7 @@
6370 * metadata: either the running transaction or the committing
6471 * transaction (if there is one). Only applies to buffers on a
6572 * transaction's data or metadata journaling list.
66
- * [j_list_lock] [jbd_lock_bh_state()]
73
+ * [j_list_lock] [b_state_lock]
6774 * Either of these locks is enough for reading, both are needed for
6875 * changes.
6976 */
....@@ -73,13 +80,13 @@
7380 * Pointer to the running compound transaction which is currently
7481 * modifying the buffer's metadata, if there was already a transaction
7582 * committing it when the new transaction touched it.
76
- * [t_list_lock] [jbd_lock_bh_state()]
83
+ * [t_list_lock] [b_state_lock]
7784 */
7885 transaction_t *b_next_transaction;
7986
8087 /*
8188 * Doubly-linked list of buffers on a transaction's data, metadata or
82
- * forget queue. [t_list_lock] [jbd_lock_bh_state()]
89
+ * forget queue. [t_list_lock] [b_state_lock]
8390 */
8491 struct journal_head *b_tnext, *b_tprev;
8592