linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] Updated locking documentation for journal_t
@ 2021-02-10  9:57 Alexander Lochmann
  2021-02-10  9:57 ` [PATCH 1/2] Updated locking documentation for transaction_t Alexander Lochmann
  2021-02-11  9:37 ` [PATCH 2/2] Updated locking documentation for journal_t Jan Kara
  0 siblings, 2 replies; 12+ messages in thread
From: Alexander Lochmann @ 2021-02-10  9:57 UTC (permalink / raw)
  Cc: Alexander Lochmann, Horst Schirmeier, Theodore Ts'o,
	Jan Kara, linux-ext4, linux-kernel

Some members of transaction_t are allowed to be read without
any lock being held if consistency doesn't matter.
Based on LockDoc's findings, we extended the locking
documentation of those members.
Each one of them is marked with a short comment:
"no lock for quick racy checks".

Signed-off-by: Alexander Lochmann <alexander.lochmann@tu-dortmund.de>
Signed-off-by: Horst Schirmeier <horst.schirmeier@tu-dortmund.de>
---
 include/linux/jbd2.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 18f77d9b1745..4dca33a063dd 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -768,7 +768,7 @@ enum passtype {PASS_SCAN, PASS_REVOKE, PASS_REPLAY};
 struct journal_s
 {
 	/**
-	 * @j_flags: General journaling state flags [j_state_lock]
+	 * @j_flags: General journaling state flags [j_state_lock, no lock for quick racy checks]
 	 */
 	unsigned long		j_flags;
 
@@ -808,7 +808,7 @@ struct journal_s
 	/**
 	 * @j_barrier_count:
 	 *
-	 * Number of processes waiting to create a barrier lock [j_state_lock]
+	 * Number of processes waiting to create a barrier lock [j_state_lock, no lock for quick racy checks]
 	 */
 	int			j_barrier_count;
 
@@ -821,7 +821,7 @@ struct journal_s
 	 * @j_running_transaction:
 	 *
 	 * Transactions: The current running transaction...
-	 * [j_state_lock] [caller holding open handle]
+	 * [j_state_lock, no lock for quick racy checks] [caller holding open handle]
 	 */
 	transaction_t		*j_running_transaction;
 
@@ -1033,7 +1033,7 @@ struct journal_s
 	 * @j_commit_sequence:
 	 *
 	 * Sequence number of the most recently committed transaction
-	 * [j_state_lock].
+	 * [j_state_lock, no lock for quick racy checks].
 	 */
 	tid_t			j_commit_sequence;
 
@@ -1041,7 +1041,7 @@ struct journal_s
 	 * @j_commit_request:
 	 *
 	 * Sequence number of the most recent transaction wanting commit
-	 * [j_state_lock]
+	 * [j_state_lock, no lock for quick racy checks]
 	 */
 	tid_t			j_commit_request;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [PATCH 1/2] Updated locking documentation for transaction_t
@ 2021-02-10  9:56 Alexander Lochmann
  0 siblings, 0 replies; 12+ messages in thread
From: Alexander Lochmann @ 2021-02-10  9:56 UTC (permalink / raw)
  Cc: Alexander Lochmann, Horst Schirmeier, Theodore Ts'o,
	Jan Kara, linux-ext4, linux-kernel

Some members of transaction_t are allowed to be read without
any lock being held if consistency doesn't matter.
Based on LockDoc's findings, we extended the locking
documentation of those members.
Each one of them is marked with a short comment:
"no lock for quick racy checks".

Signed-off-by: Alexander Lochmann <alexander.lochmann@tu-dortmund.de>
Signed-off-by: Horst Schirmeier <horst.schirmeier@tu-dortmund.de>
---
 include/linux/jbd2.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 99d3cd051ac3..18f77d9b1745 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -594,18 +594,18 @@ struct transaction_s
 	 */
 	unsigned long		t_log_start;
 
-	/* Number of buffers on the t_buffers list [j_list_lock] */
+	/* Number of buffers on the t_buffers list [j_list_lock, no lock for quick racy checks] */
 	int			t_nr_buffers;
 
 	/*
 	 * Doubly-linked circular list of all buffers reserved but not yet
-	 * modified by this transaction [j_list_lock]
+	 * modified by this transaction [j_list_lock, no lock for quick racy checks]
 	 */
 	struct journal_head	*t_reserved_list;
 
 	/*
 	 * Doubly-linked circular list of all metadata buffers owned by this
-	 * transaction [j_list_lock]
+	 * transaction [j_list_lock, no lock for quick racy checks]
 	 */
 	struct journal_head	*t_buffers;
 
@@ -631,7 +631,7 @@ struct transaction_s
 	/*
 	 * Doubly-linked circular list of metadata buffers being shadowed by log
 	 * IO.  The IO buffers on the iobuf list and the shadow buffers on this
-	 * list match each other one for one at all times. [j_list_lock]
+	 * list match each other one for one at all times. [j_list_lock, no lock for quick racy checks]
 	 */
 	struct journal_head	*t_shadow_list;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-04-02 15:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10  9:57 [PATCH 2/2] Updated locking documentation for journal_t Alexander Lochmann
2021-02-10  9:57 ` [PATCH 1/2] Updated locking documentation for transaction_t Alexander Lochmann
2021-02-11  9:30   ` Jan Kara
2021-02-11  9:53     ` Alexander Lochmann
2021-02-11 13:13       ` Jan Kara
2021-03-26  8:18     ` Alexander Lochmann
2021-03-29 10:14       ` Jan Kara
2021-02-11  9:37 ` [PATCH 2/2] Updated locking documentation for journal_t Jan Kara
2021-02-11  9:51   ` [PATCH v2] " Alexander Lochmann
2021-03-17 20:57     ` Alexander Lochmann
2021-04-02 15:40     ` Theodore Ts'o
  -- strict thread matches above, loose matches on Subject: below --
2021-02-10  9:56 [PATCH 1/2] Updated locking documentation for transaction_t Alexander Lochmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).