Skip to content

Commit

Permalink
jbd: finish conversion from WRITE_SYNC_PLUG to WRITE_SYNC and explici…
Browse files Browse the repository at this point in the history
…t 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 4ee2491 commit 65ab802
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions fs/jbd/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/bio.h>
#include <linux/blkdev.h>

/*
* Default IO end handler for temporary BJ_IO buffer_heads.
Expand Down Expand Up @@ -294,7 +295,7 @@ void journal_commit_transaction(journal_t *journal)
int first_tag = 0;
int tag_flag;
int i;
int write_op = WRITE_SYNC;
struct blk_plug plug;

/*
* First job: lock down the current transaction and wait for
Expand Down Expand Up @@ -327,13 +328,6 @@ void journal_commit_transaction(journal_t *journal)
spin_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;
spin_lock(&commit_transaction->t_handle_lock);
while (commit_transaction->t_updates) {
DEFINE_WAIT(wait);
Expand Down Expand Up @@ -418,8 +412,10 @@ void journal_commit_transaction(journal_t *journal)
* Now start flushing things to disk, in the order they appear
* on the transaction lists. Data blocks go first.
*/
blk_start_plug(&plug);
err = journal_submit_data_buffers(journal, commit_transaction,
write_op);
WRITE_SYNC);
blk_finish_plug(&plug);

/*
* Wait for all previously submitted IO to complete.
Expand Down Expand Up @@ -480,7 +476,9 @@ void journal_commit_transaction(journal_t *journal)
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
Expand Down Expand Up @@ -650,7 +648,7 @@ void 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();

Expand All @@ -661,6 +659,8 @@ void journal_commit_transaction(journal_t *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 65ab802

Please sign in to comment.