diff options
author | Theodore Ts'o <tytso@mit.edu> | 2014-03-09 00:56:58 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-03-09 00:56:58 -0500 |
commit | 0bfea8118d8e4f6aeb476511350d649e8dcb0ce8 (patch) | |
tree | f78d7495e83392caf03d3a10aa3455cc01bc6527 /fs/jbd2 | |
parent | 6e4862a5bb9d12be87e4ea5d9a60836ebed71d28 (diff) |
jbd2: minimize region locked by j_list_lock in jbd2_journal_forget()
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>
Diffstat (limited to 'fs/jbd2')
-rw-r--r-- | fs/jbd2/transaction.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 357f3dc5201f..d999b1f6847c 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -1416,7 +1416,6 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh) | |||
1416 | BUFFER_TRACE(bh, "entry"); | 1416 | BUFFER_TRACE(bh, "entry"); |
1417 | 1417 | ||
1418 | jbd_lock_bh_state(bh); | 1418 | jbd_lock_bh_state(bh); |
1419 | spin_lock(&journal->j_list_lock); | ||
1420 | 1419 | ||
1421 | if (!buffer_jbd(bh)) | 1420 | if (!buffer_jbd(bh)) |
1422 | goto not_jbd; | 1421 | goto not_jbd; |
@@ -1469,6 +1468,7 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh) | |||
1469 | * we know to remove the checkpoint after we commit. | 1468 | * we know to remove the checkpoint after we commit. |
1470 | */ | 1469 | */ |
1471 | 1470 | ||
1471 | spin_lock(&journal->j_list_lock); | ||
1472 | if (jh->b_cp_transaction) { | 1472 | if (jh->b_cp_transaction) { |
1473 | __jbd2_journal_temp_unlink_buffer(jh); | 1473 | __jbd2_journal_temp_unlink_buffer(jh); |
1474 | __jbd2_journal_file_buffer(jh, transaction, BJ_Forget); | 1474 | __jbd2_journal_file_buffer(jh, transaction, BJ_Forget); |
@@ -1481,6 +1481,7 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh) | |||
1481 | goto drop; | 1481 | goto drop; |
1482 | } | 1482 | } |
1483 | } | 1483 | } |
1484 | spin_unlock(&journal->j_list_lock); | ||
1484 | } else if (jh->b_transaction) { | 1485 | } else if (jh->b_transaction) { |
1485 | J_ASSERT_JH(jh, (jh->b_transaction == | 1486 | J_ASSERT_JH(jh, (jh->b_transaction == |
1486 | journal->j_committing_transaction)); | 1487 | journal->j_committing_transaction)); |
@@ -1492,7 +1493,9 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh) | |||
1492 | 1493 | ||
1493 | if (jh->b_next_transaction) { | 1494 | if (jh->b_next_transaction) { |
1494 | J_ASSERT(jh->b_next_transaction == transaction); | 1495 | J_ASSERT(jh->b_next_transaction == transaction); |
1496 | spin_lock(&journal->j_list_lock); | ||
1495 | jh->b_next_transaction = NULL; | 1497 | jh->b_next_transaction = NULL; |
1498 | spin_unlock(&journal->j_list_lock); | ||
1496 | 1499 | ||
1497 | /* | 1500 | /* |
1498 | * only drop a reference if this transaction modified | 1501 | * only drop a reference if this transaction modified |
@@ -1504,7 +1507,6 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh) | |||
1504 | } | 1507 | } |
1505 | 1508 | ||
1506 | not_jbd: | 1509 | not_jbd: |
1507 | spin_unlock(&journal->j_list_lock); | ||
1508 | jbd_unlock_bh_state(bh); | 1510 | jbd_unlock_bh_state(bh); |
1509 | __brelse(bh); | 1511 | __brelse(bh); |
1510 | drop: | 1512 | drop: |