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: Jens Axboe <jaxboe@fusionio.com>

+11 -11
+11 -11
fs/jbd/commit.c
··· 20 20 #include <linux/mm.h> 21 21 #include <linux/pagemap.h> 22 22 #include <linux/bio.h> 23 + #include <linux/blkdev.h> 23 24 24 25 /* 25 26 * Default IO end handler for temporary BJ_IO buffer_heads. ··· 295 294 int first_tag = 0; 296 295 int tag_flag; 297 296 int i; 298 - int write_op = WRITE_SYNC; 297 + struct blk_plug plug; 299 298 300 299 /* 301 300 * First job: lock down the current transaction and wait for ··· 328 327 spin_lock(&journal->j_state_lock); 329 328 commit_transaction->t_state = T_LOCKED; 330 329 331 - /* 332 - * Use plugged writes here, since we want to submit several before 333 - * we unplug the device. We don't do explicit unplugging in here, 334 - * instead we rely on sync_buffer() doing the unplug for us. 335 - */ 336 - if (commit_transaction->t_synchronous_commit) 337 - write_op = WRITE_SYNC; 338 330 spin_lock(&commit_transaction->t_handle_lock); 339 331 while (commit_transaction->t_updates) { 340 332 DEFINE_WAIT(wait); ··· 412 418 * Now start flushing things to disk, in the order they appear 413 419 * on the transaction lists. Data blocks go first. 414 420 */ 421 + blk_start_plug(&plug); 415 422 err = journal_submit_data_buffers(journal, commit_transaction, 416 - write_op); 423 + WRITE_SYNC); 424 + blk_finish_plug(&plug); 417 425 418 426 /* 419 427 * Wait for all previously submitted IO to complete. ··· 476 480 err = 0; 477 481 } 478 482 479 - journal_write_revoke_records(journal, commit_transaction, write_op); 483 + blk_start_plug(&plug); 484 + 485 + journal_write_revoke_records(journal, commit_transaction, WRITE_SYNC); 480 486 481 487 /* 482 488 * If we found any dirty or locked buffers, then we should have ··· 648 650 clear_buffer_dirty(bh); 649 651 set_buffer_uptodate(bh); 650 652 bh->b_end_io = journal_end_buffer_io_sync; 651 - submit_bh(write_op, bh); 653 + submit_bh(WRITE_SYNC, bh); 652 654 } 653 655 cond_resched(); 654 656 ··· 658 660 bufs = 0; 659 661 } 660 662 } 663 + 664 + blk_finish_plug(&plug); 661 665 662 666 /* Lo and behold: we have just managed to send a transaction to 663 667 the log. Before we can commit it, wait for the IO so far to