You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
@@ -1073,7 +1073,6 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh)
|
|||||||
* reused here.
|
* reused here.
|
||||||
*/
|
*/
|
||||||
jbd_lock_bh_state(bh);
|
jbd_lock_bh_state(bh);
|
||||||
spin_lock(&journal->j_list_lock);
|
|
||||||
J_ASSERT_JH(jh, (jh->b_transaction == transaction ||
|
J_ASSERT_JH(jh, (jh->b_transaction == transaction ||
|
||||||
jh->b_transaction == NULL ||
|
jh->b_transaction == NULL ||
|
||||||
(jh->b_transaction == journal->j_committing_transaction &&
|
(jh->b_transaction == journal->j_committing_transaction &&
|
||||||
@@ -1096,12 +1095,14 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh)
|
|||||||
jh->b_modified = 0;
|
jh->b_modified = 0;
|
||||||
|
|
||||||
JBUFFER_TRACE(jh, "file as BJ_Reserved");
|
JBUFFER_TRACE(jh, "file as BJ_Reserved");
|
||||||
|
spin_lock(&journal->j_list_lock);
|
||||||
__jbd2_journal_file_buffer(jh, transaction, BJ_Reserved);
|
__jbd2_journal_file_buffer(jh, transaction, BJ_Reserved);
|
||||||
} else if (jh->b_transaction == journal->j_committing_transaction) {
|
} else if (jh->b_transaction == journal->j_committing_transaction) {
|
||||||
/* first access by this transaction */
|
/* first access by this transaction */
|
||||||
jh->b_modified = 0;
|
jh->b_modified = 0;
|
||||||
|
|
||||||
JBUFFER_TRACE(jh, "set next transaction");
|
JBUFFER_TRACE(jh, "set next transaction");
|
||||||
|
spin_lock(&journal->j_list_lock);
|
||||||
jh->b_next_transaction = transaction;
|
jh->b_next_transaction = transaction;
|
||||||
}
|
}
|
||||||
spin_unlock(&journal->j_list_lock);
|
spin_unlock(&journal->j_list_lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user