Skip to content

Commit 6e4862a

Browse files
committed
jbd2: minimize region locked by j_list_lock in journal_get_create_access()
It's not needed until we start trying to modifying fields in the journal_head which are protected by j_list_lock. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1 parent d2eb0b9 commit 6e4862a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎fs/jbd2/transaction.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,6 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh)
10731073
* reused here.
10741074
*/
10751075
jbd_lock_bh_state(bh);
1076-
spin_lock(&journal->j_list_lock);
10771076
J_ASSERT_JH(jh, (jh->b_transaction == transaction ||
10781077
jh->b_transaction == NULL ||
10791078
(jh->b_transaction == journal->j_committing_transaction &&
@@ -1096,12 +1095,14 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh)
10961095
jh->b_modified = 0;
10971096

10981097
JBUFFER_TRACE(jh, "file as BJ_Reserved");
1098+
spin_lock(&journal->j_list_lock);
10991099
__jbd2_journal_file_buffer(jh, transaction, BJ_Reserved);
11001100
} else if (jh->b_transaction == journal->j_committing_transaction) {
11011101
/* first access by this transaction */
11021102
jh->b_modified = 0;
11031103

11041104
JBUFFER_TRACE(jh, "set next transaction");
1105+
spin_lock(&journal->j_list_lock);
11051106
jh->b_next_transaction = transaction;
11061107
}
11071108
spin_unlock(&journal->j_list_lock);

0 commit comments

Comments
 (0)