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