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>

+8 -10
+8 -10
fs/jbd2/commit.c
··· 329 329 int tag_bytes = journal_tag_bytes(journal); 330 330 struct buffer_head *cbh = NULL; /* For transactional checksums */ 331 331 __u32 crc32_sum = ~0; 332 - int write_op = WRITE_SYNC; 332 + struct blk_plug plug; 333 333 334 334 /* 335 335 * First job: lock down the current transaction and wait for ··· 363 363 write_lock(&journal->j_state_lock); 364 364 commit_transaction->t_state = T_LOCKED; 365 365 366 - /* 367 - * Use plugged writes here, since we want to submit several before 368 - * we unplug the device. We don't do explicit unplugging in here, 369 - * instead we rely on sync_buffer() doing the unplug for us. 370 - */ 371 - if (commit_transaction->t_synchronous_commit) 372 - write_op = WRITE_SYNC; 373 366 trace_jbd2_commit_locking(journal, commit_transaction); 374 367 stats.run.rs_wait = commit_transaction->t_max_wait; 375 368 stats.run.rs_locked = jiffies; ··· 462 469 if (err) 463 470 jbd2_journal_abort(journal, err); 464 471 472 + blk_start_plug(&plug); 465 473 jbd2_journal_write_revoke_records(journal, commit_transaction, 466 - write_op); 474 + WRITE_SYNC); 475 + blk_finish_plug(&plug); 467 476 468 477 jbd_debug(3, "JBD: commit phase 2\n"); 469 478 ··· 492 497 err = 0; 493 498 descriptor = NULL; 494 499 bufs = 0; 500 + blk_start_plug(&plug); 495 501 while (commit_transaction->t_buffers) { 496 502 497 503 /* Find the next buffer to be journaled... */ ··· 654 658 clear_buffer_dirty(bh); 655 659 set_buffer_uptodate(bh); 656 660 bh->b_end_io = journal_end_buffer_io_sync; 657 - submit_bh(write_op, bh); 661 + submit_bh(WRITE_SYNC, bh); 658 662 } 659 663 cond_resched(); 660 664 stats.run.rs_blocks_logged += bufs; ··· 694 698 if (err) 695 699 __jbd2_journal_abort_hard(journal); 696 700 } 701 + 702 + blk_finish_plug(&plug); 697 703 698 704 /* Lo and behold: we have just managed to send a transaction to 699 705 the log. Before we can commit it, wait for the IO so far to