Commit 4194b1ea authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

jbd2: use WRITE_SYNC_PLUG instead of WRITE_SYNC

When you are going to be submitting several sync writes, we want to
give the IO scheduler a chance to merge some of them. Instead of
using the implicitly unplugging WRITE_SYNC variant, use WRITE_SYNC_PLUG
and rely on sync_buffer() doing the unplug when someone does a
wait_on_buffer()/lock_buffer().
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6c4bac6b
...@@ -138,7 +138,7 @@ static int journal_submit_commit_record(journal_t *journal, ...@@ -138,7 +138,7 @@ static int journal_submit_commit_record(journal_t *journal,
set_buffer_ordered(bh); set_buffer_ordered(bh);
barrier_done = 1; barrier_done = 1;
} }
ret = submit_bh(WRITE_SYNC, bh); ret = submit_bh(WRITE_SYNC_PLUG, bh);
if (barrier_done) if (barrier_done)
clear_buffer_ordered(bh); clear_buffer_ordered(bh);
...@@ -159,7 +159,7 @@ static int journal_submit_commit_record(journal_t *journal, ...@@ -159,7 +159,7 @@ static int journal_submit_commit_record(journal_t *journal,
lock_buffer(bh); lock_buffer(bh);
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
clear_buffer_dirty(bh); clear_buffer_dirty(bh);
ret = submit_bh(WRITE_SYNC, bh); ret = submit_bh(WRITE_SYNC_PLUG, bh);
} }
*cbh = bh; *cbh = bh;
return ret; return ret;
...@@ -190,7 +190,7 @@ retry: ...@@ -190,7 +190,7 @@ retry:
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
bh->b_end_io = journal_end_buffer_io_sync; bh->b_end_io = journal_end_buffer_io_sync;
ret = submit_bh(WRITE_SYNC, bh); ret = submit_bh(WRITE_SYNC_PLUG, bh);
if (ret) { if (ret) {
unlock_buffer(bh); unlock_buffer(bh);
return ret; return ret;
...@@ -402,8 +402,13 @@ void jbd2_journal_commit_transaction(journal_t *journal) ...@@ -402,8 +402,13 @@ void jbd2_journal_commit_transaction(journal_t *journal)
spin_lock(&journal->j_state_lock); spin_lock(&journal->j_state_lock);
commit_transaction->t_state = T_LOCKED; commit_transaction->t_state = T_LOCKED;
/*
* Use plugged writes here, since we want to submit several before
* we unplug the device. We don't do explicit unplugging in here,
* instead we rely on sync_buffer() doing the unplug for us.
*/
if (commit_transaction->t_synchronous_commit) if (commit_transaction->t_synchronous_commit)
write_op = WRITE_SYNC; write_op = WRITE_SYNC_PLUG;
stats.u.run.rs_wait = commit_transaction->t_max_wait; stats.u.run.rs_wait = commit_transaction->t_max_wait;
stats.u.run.rs_locked = jiffies; stats.u.run.rs_locked = jiffies;
stats.u.run.rs_running = jbd2_time_diff(commit_transaction->t_start, stats.u.run.rs_running = jbd2_time_diff(commit_transaction->t_start,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment