diff options
| author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-08 05:37:58 -0400 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-08 05:37:58 -0400 |
| commit | 5a2cec83a9bb1b4295aa8ab728fcb8ca1811a33c (patch) | |
| tree | 2f83dc6949763e77cf6422e696dc6146684dcf4e /fs/jbd/commit.c | |
| parent | f2c853bca542f5ac0b036377637192a74f2091c2 (diff) | |
| parent | caf39e87cc1182f7dae84eefc43ca14d54c78ef9 (diff) | |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'fs/jbd/commit.c')
| -rw-r--r-- | fs/jbd/commit.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index dac720c837ab..2a3e310f79ef 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
| @@ -358,7 +358,7 @@ write_out_data: | |||
| 358 | jbd_debug(2, "submit %d writes\n", | 358 | jbd_debug(2, "submit %d writes\n", |
| 359 | bufs); | 359 | bufs); |
| 360 | spin_unlock(&journal->j_list_lock); | 360 | spin_unlock(&journal->j_list_lock); |
| 361 | ll_rw_block(WRITE, bufs, wbuf); | 361 | ll_rw_block(SWRITE, bufs, wbuf); |
| 362 | journal_brelse_array(wbuf, bufs); | 362 | journal_brelse_array(wbuf, bufs); |
| 363 | bufs = 0; | 363 | bufs = 0; |
| 364 | goto write_out_data; | 364 | goto write_out_data; |
| @@ -381,7 +381,7 @@ write_out_data: | |||
| 381 | 381 | ||
| 382 | if (bufs) { | 382 | if (bufs) { |
| 383 | spin_unlock(&journal->j_list_lock); | 383 | spin_unlock(&journal->j_list_lock); |
| 384 | ll_rw_block(WRITE, bufs, wbuf); | 384 | ll_rw_block(SWRITE, bufs, wbuf); |
| 385 | journal_brelse_array(wbuf, bufs); | 385 | journal_brelse_array(wbuf, bufs); |
| 386 | spin_lock(&journal->j_list_lock); | 386 | spin_lock(&journal->j_list_lock); |
| 387 | } | 387 | } |
| @@ -720,11 +720,17 @@ wait_for_iobuf: | |||
| 720 | J_ASSERT(commit_transaction->t_log_list == NULL); | 720 | J_ASSERT(commit_transaction->t_log_list == NULL); |
| 721 | 721 | ||
| 722 | restart_loop: | 722 | restart_loop: |
| 723 | /* | ||
| 724 | * As there are other places (journal_unmap_buffer()) adding buffers | ||
| 725 | * to this list we have to be careful and hold the j_list_lock. | ||
| 726 | */ | ||
| 727 | spin_lock(&journal->j_list_lock); | ||
| 723 | while (commit_transaction->t_forget) { | 728 | while (commit_transaction->t_forget) { |
| 724 | transaction_t *cp_transaction; | 729 | transaction_t *cp_transaction; |
| 725 | struct buffer_head *bh; | 730 | struct buffer_head *bh; |
| 726 | 731 | ||
| 727 | jh = commit_transaction->t_forget; | 732 | jh = commit_transaction->t_forget; |
| 733 | spin_unlock(&journal->j_list_lock); | ||
| 728 | bh = jh2bh(jh); | 734 | bh = jh2bh(jh); |
| 729 | jbd_lock_bh_state(bh); | 735 | jbd_lock_bh_state(bh); |
| 730 | J_ASSERT_JH(jh, jh->b_transaction == commit_transaction || | 736 | J_ASSERT_JH(jh, jh->b_transaction == commit_transaction || |
| @@ -792,9 +798,25 @@ restart_loop: | |||
| 792 | journal_remove_journal_head(bh); /* needs a brelse */ | 798 | journal_remove_journal_head(bh); /* needs a brelse */ |
| 793 | release_buffer_page(bh); | 799 | release_buffer_page(bh); |
| 794 | } | 800 | } |
| 801 | cond_resched_lock(&journal->j_list_lock); | ||
| 802 | } | ||
| 803 | spin_unlock(&journal->j_list_lock); | ||
| 804 | /* | ||
| 805 | * This is a bit sleazy. We borrow j_list_lock to protect | ||
| 806 | * journal->j_committing_transaction in __journal_remove_checkpoint. | ||
| 807 | * Really, __journal_remove_checkpoint should be using j_state_lock but | ||
| 808 | * it's a bit hassle to hold that across __journal_remove_checkpoint | ||
| 809 | */ | ||
| 810 | spin_lock(&journal->j_state_lock); | ||
| 811 | spin_lock(&journal->j_list_lock); | ||
| 812 | /* | ||
| 813 | * Now recheck if some buffers did not get attached to the transaction | ||
| 814 | * while the lock was dropped... | ||
| 815 | */ | ||
| 816 | if (commit_transaction->t_forget) { | ||
| 795 | spin_unlock(&journal->j_list_lock); | 817 | spin_unlock(&journal->j_list_lock); |
| 796 | if (cond_resched()) | 818 | spin_unlock(&journal->j_state_lock); |
| 797 | goto restart_loop; | 819 | goto restart_loop; |
| 798 | } | 820 | } |
| 799 | 821 | ||
| 800 | /* Done with this transaction! */ | 822 | /* Done with this transaction! */ |
| @@ -803,14 +825,6 @@ restart_loop: | |||
| 803 | 825 | ||
| 804 | J_ASSERT(commit_transaction->t_state == T_COMMIT); | 826 | J_ASSERT(commit_transaction->t_state == T_COMMIT); |
| 805 | 827 | ||
| 806 | /* | ||
| 807 | * This is a bit sleazy. We borrow j_list_lock to protect | ||
| 808 | * journal->j_committing_transaction in __journal_remove_checkpoint. | ||
| 809 | * Really, __jornal_remove_checkpoint should be using j_state_lock but | ||
| 810 | * it's a bit hassle to hold that across __journal_remove_checkpoint | ||
| 811 | */ | ||
| 812 | spin_lock(&journal->j_state_lock); | ||
| 813 | spin_lock(&journal->j_list_lock); | ||
| 814 | commit_transaction->t_state = T_FINISHED; | 828 | commit_transaction->t_state = T_FINISHED; |
| 815 | J_ASSERT(commit_transaction == journal->j_committing_transaction); | 829 | J_ASSERT(commit_transaction == journal->j_committing_transaction); |
| 816 | journal->j_commit_sequence = commit_transaction->t_tid; | 830 | journal->j_commit_sequence = commit_transaction->t_tid; |
