Skip to content

Commit

Permalink
jbd2: finish conversion from WRITE_SYNC_PLUG to WRITE_SYNC and explic…
Browse files Browse the repository at this point in the history
…it 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 <[email protected]>
  • Loading branch information
Jens Axboe committed Mar 17, 2011
1 parent 65ab802 commit 82f04ab
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions fs/jbd2/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
int tag_bytes = journal_tag_bytes(journal);
struct buffer_head *cbh = NULL; /* For transactional checksums */
__u32 crc32_sum = ~0;
int write_op = WRITE_SYNC;
struct blk_plug plug;

/*
* First job: lock down the current transaction and wait for
Expand Down Expand Up @@ -363,13 +363,6 @@ void jbd2_journal_commit_transaction(journal_t *journal)
write_lock(&journal->j_state_lock);
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);
stats.run.rs_wait = commit_transaction->t_max_wait;
stats.run.rs_locked = jiffies;
Expand Down Expand Up @@ -469,8 +462,10 @@ void jbd2_journal_commit_transaction(journal_t *journal)
if (err)
jbd2_journal_abort(journal, err);

blk_start_plug(&plug);
jbd2_journal_write_revoke_records(journal, commit_transaction,
write_op);
WRITE_SYNC);
blk_finish_plug(&plug);

jbd_debug(3, "JBD: commit phase 2\n");

Expand All @@ -497,6 +492,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
err = 0;
descriptor = NULL;
bufs = 0;
blk_start_plug(&plug);
while (commit_transaction->t_buffers) {

/* Find the next buffer to be journaled... */
Expand Down Expand Up @@ -658,7 +654,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
clear_buffer_dirty(bh);
set_buffer_uptodate(bh);
bh->b_end_io = journal_end_buffer_io_sync;
submit_bh(write_op, bh);
submit_bh(WRITE_SYNC, bh);
}
cond_resched();
stats.run.rs_blocks_logged += bufs;
Expand Down Expand Up @@ -699,6 +695,8 @@ void jbd2_journal_commit_transaction(journal_t *journal)
__jbd2_journal_abort_hard(journal);
}

blk_finish_plug(&plug);

/* 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
complete. Control buffers being written are on the
Expand Down

0 comments on commit 82f04ab

Please sign in to comment.