Skip to content

Commit

Permalink
ext4: updated locking documentation for journal_t
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/ad82c7a9-a624-4ed5-5ada-a6410c44c0b3@tu-dortmund.de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
Alexander Lochmann authored and Theodore Ts'o committed Apr 2, 2021
1 parent bd256fd commit d699ae4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions include/linux/jbd2.h
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,8 @@ 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;

Expand Down Expand Up @@ -808,7 +809,8 @@ 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;

Expand All @@ -821,7 +823,8 @@ 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;

Expand Down Expand Up @@ -1033,15 +1036,15 @@ 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;

/**
* @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;

Expand Down

0 comments on commit d699ae4

Please sign in to comment.