1 jbd2: check jh->b_transaction without taking j_list_lock
3 jh->b_transaction is adequately protected for reading by the
4 jbd_lock_bh_state(bh), so we don't need to take j_list_lock in
5 __journal_try_to_free_buffer().
7 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
9 fs/jbd2/transaction.c | 4 ++--
10 1 file changed, 2 insertions(+), 2 deletions(-)
12 diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
13 index 60bb365..78900a1 100644
14 --- a/fs/jbd2/transaction.c
15 +++ b/fs/jbd2/transaction.c
16 @@ -1821,11 +1821,11 @@ __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh)
17 if (buffer_locked(bh) || buffer_dirty(bh))
20 - if (jh->b_next_transaction != NULL)
21 + if (jh->b_next_transaction != NULL || jh->b_transaction != NULL)
24 spin_lock(&journal->j_list_lock);
25 - if (jh->b_cp_transaction != NULL && jh->b_transaction == NULL) {
26 + if (jh->b_cp_transaction != NULL) {
27 /* written-back checkpointed metadata buffer */
28 JBUFFER_TRACE(jh, "remove from checkpoint list");
29 __jbd2_journal_remove_checkpoint(jh);