Signed-off-by: Andrew Morton Index: linux-2.6.8-rc1/fs/jbd/commit.c =================================================================== --- linux-2.6.8-rc1.orig/fs/jbd/commit.c 2004-07-15 10:03:35.057848821 +1000 +++ linux-2.6.8-rc1/fs/jbd/commit.c 2004-07-15 10:03:36.600603258 +1000 @@ -114,6 +114,7 @@ int space_left = 0; int first_tag = 0; int tag_flag; + int nr_buffers = 0; int i; /* @@ -269,8 +270,10 @@ __journal_file_buffer(jh, commit_transaction, BJ_Locked); jbd_unlock_bh_state(bh); - if (need_resched()) { + nr_buffers++; + if ((nr_buffers & 15) == 0 || need_resched()) { spin_unlock(&journal->j_list_lock); + cpu_relax(); goto write_out_data; } } else { @@ -295,8 +298,10 @@ jbd_unlock_bh_state(bh); journal_remove_journal_head(bh); put_bh(bh); - if (need_resched()) { + nr_buffers++; + if ((nr_buffers & 15) == 0 || need_resched()) { spin_unlock(&journal->j_list_lock); + cpu_relax(); goto write_out_data; } } @@ -340,7 +345,8 @@ jbd_unlock_bh_state(bh); } put_bh(bh); - if (need_resched()) { + nr_buffers++; + if ((nr_buffers & 15) == 0 || need_resched()) { spin_unlock(&journal->j_list_lock); cond_resched(); spin_lock(&journal->j_list_lock);