diff options
author | Jens Axboe <jaxboe@fusionio.com> | 2011-03-17 06:01:52 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-03-17 06:01:52 -0400 |
commit | 82f04ab47e1d94d78503591a7460b2cad9601ede (patch) | |
tree | a79fd1ba1c8dce2147cb3bea54357321f73e642d | |
parent | 65ab80279d7c323ce151e858d951e2684df72a97 (diff) |
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>
-rw-r--r-- | fs/jbd2/commit.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 3da1cc4346d5..fa36d7662b21 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -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; | ||
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; |
@@ -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 |