jbd: finish conversion from WRITE_SYNC_PLUG to WRITE_SYNC and explicit plugging

'write_op' was still used, even though it was always WRITE_SYNC now.
Add plugging around the cases where it submits IO, and flush them
before we end up waiting for that IO.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
This commit is contained in:
Jens Axboe
2011-03-17 10:56:45 +01:00
parent 4ee2491ed8
commit 65ab80279d

View File

@@ -20,6 +20,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/bio.h> #include <linux/bio.h>
#include <linux/blkdev.h>
/* /*
* Default IO end handler for temporary BJ_IO buffer_heads. * Default IO end handler for temporary BJ_IO buffer_heads.
@@ -294,7 +295,7 @@ void journal_commit_transaction(journal_t *journal)
int first_tag = 0; int first_tag = 0;
int tag_flag; int tag_flag;
int i; int i;
int write_op = WRITE_SYNC; struct blk_plug plug;
/* /*
* First job: lock down the current transaction and wait for * First job: lock down the current transaction and wait for
@@ -327,13 +328,6 @@ void 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)
write_op = WRITE_SYNC;
spin_lock(&commit_transaction->t_handle_lock); spin_lock(&commit_transaction->t_handle_lock);
while (commit_transaction->t_updates) { while (commit_transaction->t_updates) {
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
@@ -418,8 +412,10 @@ void journal_commit_transaction(journal_t *journal)
* Now start flushing things to disk, in the order they appear * Now start flushing things to disk, in the order they appear
* on the transaction lists. Data blocks go first. * on the transaction lists. Data blocks go first.
*/ */
blk_start_plug(&plug);
err = journal_submit_data_buffers(journal, commit_transaction, err = journal_submit_data_buffers(journal, commit_transaction,
write_op); WRITE_SYNC);
blk_finish_plug(&plug);
/* /*
* Wait for all previously submitted IO to complete. * Wait for all previously submitted IO to complete.
@@ -480,7 +476,9 @@ void journal_commit_transaction(journal_t *journal)
err = 0; err = 0;
} }
journal_write_revoke_records(journal, commit_transaction, write_op); blk_start_plug(&plug);
journal_write_revoke_records(journal, commit_transaction, WRITE_SYNC);
/* /*
* If we found any dirty or locked buffers, then we should have * If we found any dirty or locked buffers, then we should have
@@ -650,7 +648,7 @@ start_journal_io:
clear_buffer_dirty(bh); clear_buffer_dirty(bh);
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;
submit_bh(write_op, bh); submit_bh(WRITE_SYNC, bh);
} }
cond_resched(); cond_resched();
@@ -661,6 +659,8 @@ start_journal_io:
} }
} }
blk_finish_plug(&plug);
/* Lo and behold: we have just managed to send a transaction to /* Lo and behold: we have just managed to send a transaction to
the log. Before we can commit it, wait for the IO so far to the log. Before we can commit it, wait for the IO so far to
complete. Control buffers being written are on the complete. Control buffers being written are on the