diff options
Diffstat (limited to 'fs/jbd/commit.c')
-rw-r--r-- | fs/jbd/commit.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index 34a4861c14b8..69b180459463 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/mm.h> | 20 | #include <linux/mm.h> |
21 | #include <linux/pagemap.h> | 21 | #include <linux/pagemap.h> |
22 | #include <linux/bio.h> | 22 | #include <linux/bio.h> |
23 | #include <linux/blkdev.h> | ||
23 | 24 | ||
24 | /* | 25 | /* |
25 | * Default IO end handler for temporary BJ_IO buffer_heads. | 26 | * Default IO end handler for temporary BJ_IO buffer_heads. |
@@ -294,7 +295,7 @@ void journal_commit_transaction(journal_t *journal) | |||
294 | int first_tag = 0; | 295 | int first_tag = 0; |
295 | int tag_flag; | 296 | int tag_flag; |
296 | int i; | 297 | int i; |
297 | int write_op = WRITE_SYNC; | 298 | struct blk_plug plug; |
298 | 299 | ||
299 | /* | 300 | /* |
300 | * First job: lock down the current transaction and wait for | 301 | * First job: lock down the current transaction and wait for |
@@ -327,13 +328,6 @@ void journal_commit_transaction(journal_t *journal) | |||
327 | spin_lock(&journal->j_state_lock); | 328 | spin_lock(&journal->j_state_lock); |
328 | commit_transaction->t_state = T_LOCKED; | 329 | commit_transaction->t_state = T_LOCKED; |
329 | 330 | ||
330 | /* | ||
331 | * Use plugged writes here, since we want to submit several before | ||
332 | * we unplug the device. We don't do explicit unplugging in here, | ||
333 | * instead we rely on sync_buffer() doing the unplug for us. | ||
334 | */ | ||
335 | if (commit_transaction->t_synchronous_commit) | ||
336 | write_op = WRITE_SYNC_PLUG; | ||
337 | spin_lock(&commit_transaction->t_handle_lock); | 331 | spin_lock(&commit_transaction->t_handle_lock); |
338 | while (commit_transaction->t_updates) { | 332 | while (commit_transaction->t_updates) { |
339 | DEFINE_WAIT(wait); | 333 | DEFINE_WAIT(wait); |
@@ -368,7 +362,7 @@ void journal_commit_transaction(journal_t *journal) | |||
368 | * we do not require it to remember exactly which old buffers it | 362 | * we do not require it to remember exactly which old buffers it |
369 | * has reserved. This is consistent with the existing behaviour | 363 | * has reserved. This is consistent with the existing behaviour |
370 | * that multiple journal_get_write_access() calls to the same | 364 | * that multiple journal_get_write_access() calls to the same |
371 | * buffer are perfectly permissable. | 365 | * buffer are perfectly permissible. |
372 | */ | 366 | */ |
373 | while (commit_transaction->t_reserved_list) { | 367 | while (commit_transaction->t_reserved_list) { |
374 | jh = commit_transaction->t_reserved_list; | 368 | jh = commit_transaction->t_reserved_list; |
@@ -418,8 +412,10 @@ void journal_commit_transaction(journal_t *journal) | |||
418 | * Now start flushing things to disk, in the order they appear | 412 | * Now start flushing things to disk, in the order they appear |
419 | * on the transaction lists. Data blocks go first. | 413 | * on the transaction lists. Data blocks go first. |
420 | */ | 414 | */ |
415 | blk_start_plug(&plug); | ||
421 | err = journal_submit_data_buffers(journal, commit_transaction, | 416 | err = journal_submit_data_buffers(journal, commit_transaction, |
422 | write_op); | 417 | WRITE_SYNC); |
418 | blk_finish_plug(&plug); | ||
423 | 419 | ||
424 | /* | 420 | /* |
425 | * Wait for all previously submitted IO to complete. | 421 | * Wait for all previously submitted IO to complete. |
@@ -480,7 +476,9 @@ void journal_commit_transaction(journal_t *journal) | |||
480 | err = 0; | 476 | err = 0; |
481 | } | 477 | } |
482 | 478 | ||
483 | journal_write_revoke_records(journal, commit_transaction, write_op); | 479 | blk_start_plug(&plug); |
480 | |||
481 | journal_write_revoke_records(journal, commit_transaction, WRITE_SYNC); | ||
484 | 482 | ||
485 | /* | 483 | /* |
486 | * If we found any dirty or locked buffers, then we should have | 484 | * If we found any dirty or locked buffers, then we should have |
@@ -650,7 +648,7 @@ start_journal_io: | |||
650 | clear_buffer_dirty(bh); | 648 | clear_buffer_dirty(bh); |
651 | set_buffer_uptodate(bh); | 649 | set_buffer_uptodate(bh); |
652 | bh->b_end_io = journal_end_buffer_io_sync; | 650 | bh->b_end_io = journal_end_buffer_io_sync; |
653 | submit_bh(write_op, bh); | 651 | submit_bh(WRITE_SYNC, bh); |
654 | } | 652 | } |
655 | cond_resched(); | 653 | cond_resched(); |
656 | 654 | ||
@@ -661,6 +659,8 @@ start_journal_io: | |||
661 | } | 659 | } |
662 | } | 660 | } |
663 | 661 | ||
662 | blk_finish_plug(&plug); | ||
663 | |||
664 | /* Lo and behold: we have just managed to send a transaction to | 664 | /* Lo and behold: we have just managed to send a transaction to |
665 | the log. Before we can commit it, wait for the IO so far to | 665 | the log. Before we can commit it, wait for the IO so far to |
666 | complete. Control buffers being written are on the | 666 | complete. Control buffers being written are on the |