Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65ab8027 authored by Jens Axboe's avatar Jens Axboe
Browse files

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: default avatarJens Axboe <jaxboe@fusionio.com>
parent 4ee2491e
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -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.
@@ -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
@@ -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);
@@ -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.
@@ -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
@@ -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();

@@ -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