1
0
Fork 0

jbd2: 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>
hifive-unleashed-5.1
Jens Axboe 2011-03-17 11:01:52 +01:00
parent 65ab80279d
commit 82f04ab47e
1 changed files with 8 additions and 10 deletions

View File

@ -329,7 +329,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
int tag_bytes = journal_tag_bytes(journal); int tag_bytes = journal_tag_bytes(journal);
struct buffer_head *cbh = NULL; /* For transactional checksums */ struct buffer_head *cbh = NULL; /* For transactional checksums */
__u32 crc32_sum = ~0; __u32 crc32_sum = ~0;
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
@ -363,13 +363,6 @@ void jbd2_journal_commit_transaction(journal_t *journal)
write_lock(&journal->j_state_lock); write_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;
trace_jbd2_commit_locking(journal, commit_transaction); trace_jbd2_commit_locking(journal, commit_transaction);
stats.run.rs_wait = commit_transaction->t_max_wait; stats.run.rs_wait = commit_transaction->t_max_wait;
stats.run.rs_locked = jiffies; stats.run.rs_locked = jiffies;
@ -469,8 +462,10 @@ void jbd2_journal_commit_transaction(journal_t *journal)
if (err) if (err)
jbd2_journal_abort(journal, err); jbd2_journal_abort(journal, err);
blk_start_plug(&plug);
jbd2_journal_write_revoke_records(journal, commit_transaction, jbd2_journal_write_revoke_records(journal, commit_transaction,
write_op); WRITE_SYNC);
blk_finish_plug(&plug);
jbd_debug(3, "JBD: commit phase 2\n"); jbd_debug(3, "JBD: commit phase 2\n");
@ -497,6 +492,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
err = 0; err = 0;
descriptor = NULL; descriptor = NULL;
bufs = 0; bufs = 0;
blk_start_plug(&plug);
while (commit_transaction->t_buffers) { while (commit_transaction->t_buffers) {
/* Find the next buffer to be journaled... */ /* Find the next buffer to be journaled... */
@ -658,7 +654,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();
stats.run.rs_blocks_logged += bufs; stats.run.rs_blocks_logged += bufs;
@ -699,6 +695,8 @@ start_journal_io:
__jbd2_journal_abort_hard(journal); __jbd2_journal_abort_hard(journal);
} }
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