diff options
Diffstat (limited to 'fs/jbd2/commit.c')
| -rw-r--r-- | fs/jbd2/commit.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index f3ad1598b201..20af62f4304b 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
| @@ -137,9 +137,9 @@ static int journal_submit_commit_record(journal_t *journal, | |||
| 137 | if (journal->j_flags & JBD2_BARRIER && | 137 | if (journal->j_flags & JBD2_BARRIER && |
| 138 | !JBD2_HAS_INCOMPAT_FEATURE(journal, | 138 | !JBD2_HAS_INCOMPAT_FEATURE(journal, |
| 139 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) | 139 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) |
| 140 | ret = submit_bh(WRITE_SYNC_PLUG | WRITE_FLUSH_FUA, bh); | 140 | ret = submit_bh(WRITE_SYNC | WRITE_FLUSH_FUA, bh); |
| 141 | else | 141 | else |
| 142 | ret = submit_bh(WRITE_SYNC_PLUG, bh); | 142 | ret = submit_bh(WRITE_SYNC, bh); |
| 143 | 143 | ||
| 144 | *cbh = bh; | 144 | *cbh = bh; |
| 145 | return ret; | 145 | return ret; |
| @@ -329,7 +329,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
| 329 | int tag_bytes = journal_tag_bytes(journal); | 329 | int tag_bytes = journal_tag_bytes(journal); |
| 330 | struct buffer_head *cbh = NULL; /* For transactional checksums */ | 330 | struct buffer_head *cbh = NULL; /* For transactional checksums */ |
| 331 | __u32 crc32_sum = ~0; | 331 | __u32 crc32_sum = ~0; |
| 332 | int write_op = WRITE_SYNC; | 332 | struct blk_plug plug; |
| 333 | 333 | ||
| 334 | /* | 334 | /* |
| 335 | * First job: lock down the current transaction and wait for | 335 | * First job: lock down the current transaction and wait for |
| @@ -363,13 +363,6 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
| 363 | write_lock(&journal->j_state_lock); | 363 | write_lock(&journal->j_state_lock); |
| 364 | commit_transaction->t_state = T_LOCKED; | 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_PLUG; | ||
| 373 | trace_jbd2_commit_locking(journal, commit_transaction); | 366 | trace_jbd2_commit_locking(journal, commit_transaction); |
| 374 | stats.run.rs_wait = commit_transaction->t_max_wait; | 367 | stats.run.rs_wait = commit_transaction->t_max_wait; |
| 375 | stats.run.rs_locked = jiffies; | 368 | stats.run.rs_locked = jiffies; |
| @@ -410,7 +403,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
| 410 | * we do not require it to remember exactly which old buffers it | 403 | * we do not require it to remember exactly which old buffers it |
| 411 | * has reserved. This is consistent with the existing behaviour | 404 | * has reserved. This is consistent with the existing behaviour |
| 412 | * that multiple jbd2_journal_get_write_access() calls to the same | 405 | * that multiple jbd2_journal_get_write_access() calls to the same |
| 413 | * buffer are perfectly permissable. | 406 | * buffer are perfectly permissible. |
| 414 | */ | 407 | */ |
| 415 | while (commit_transaction->t_reserved_list) { | 408 | while (commit_transaction->t_reserved_list) { |
| 416 | jh = commit_transaction->t_reserved_list; | 409 | jh = commit_transaction->t_reserved_list; |
| @@ -469,8 +462,10 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
| 469 | if (err) | 462 | if (err) |
| 470 | jbd2_journal_abort(journal, err); | 463 | jbd2_journal_abort(journal, err); |
| 471 | 464 | ||
| 465 | blk_start_plug(&plug); | ||
| 472 | jbd2_journal_write_revoke_records(journal, commit_transaction, | 466 | jbd2_journal_write_revoke_records(journal, commit_transaction, |
| 473 | write_op); | 467 | WRITE_SYNC); |
| 468 | blk_finish_plug(&plug); | ||
| 474 | 469 | ||
| 475 | jbd_debug(3, "JBD: commit phase 2\n"); | 470 | jbd_debug(3, "JBD: commit phase 2\n"); |
| 476 | 471 | ||
| @@ -497,6 +492,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
| 497 | err = 0; | 492 | err = 0; |
| 498 | descriptor = NULL; | 493 | descriptor = NULL; |
| 499 | bufs = 0; | 494 | bufs = 0; |
| 495 | blk_start_plug(&plug); | ||
| 500 | while (commit_transaction->t_buffers) { | 496 | while (commit_transaction->t_buffers) { |
| 501 | 497 | ||
| 502 | /* Find the next buffer to be journaled... */ | 498 | /* Find the next buffer to be journaled... */ |
| @@ -658,7 +654,7 @@ start_journal_io: | |||
| 658 | clear_buffer_dirty(bh); | 654 | clear_buffer_dirty(bh); |
| 659 | set_buffer_uptodate(bh); | 655 | set_buffer_uptodate(bh); |
| 660 | bh->b_end_io = journal_end_buffer_io_sync; | 656 | bh->b_end_io = journal_end_buffer_io_sync; |
| 661 | submit_bh(write_op, bh); | 657 | submit_bh(WRITE_SYNC, bh); |
| 662 | } | 658 | } |
| 663 | cond_resched(); | 659 | cond_resched(); |
| 664 | stats.run.rs_blocks_logged += bufs; | 660 | stats.run.rs_blocks_logged += bufs; |
| @@ -699,6 +695,8 @@ start_journal_io: | |||
| 699 | __jbd2_journal_abort_hard(journal); | 695 | __jbd2_journal_abort_hard(journal); |
| 700 | } | 696 | } |
| 701 | 697 | ||
| 698 | blk_finish_plug(&plug); | ||
| 699 | |||
| 702 | /* Lo and behold: we have just managed to send a transaction to | 700 | /* Lo and behold: we have just managed to send a transaction to |
| 703 | the log. Before we can commit it, wait for the IO so far to | 701 | the log. Before we can commit it, wait for the IO so far to |
| 704 | complete. Control buffers being written are on the | 702 | complete. Control buffers being written are on the |
