diff options
author | Jiri Kosina <jkosina@suse.cz> | 2011-04-26 04:22:15 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-04-26 04:22:59 -0400 |
commit | 07f9479a40cc778bc1462ada11f95b01360ae4ff (patch) | |
tree | 0676cf38df3844004bb3ebfd99dfa67a4a8998f5 /fs/jbd2/commit.c | |
parent | 9d5e6bdb3013acfb311ab407eeca0b6a6a3dedbf (diff) | |
parent | cd2e49e90f1cae7726c9a2c54488d881d7f1cd1c (diff) |
Merge branch 'master' into for-next
Fast-forwarded to current state of Linus' tree as there are patches to be
applied for files that didn't exist on the old branch.
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r-- | fs/jbd2/commit.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index f3ad1598b201..6e28000a4b21 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -105,6 +105,8 @@ static int journal_submit_commit_record(journal_t *journal, | |||
105 | int ret; | 105 | int ret; |
106 | struct timespec now = current_kernel_time(); | 106 | struct timespec now = current_kernel_time(); |
107 | 107 | ||
108 | *cbh = NULL; | ||
109 | |||
108 | if (is_journal_aborted(journal)) | 110 | if (is_journal_aborted(journal)) |
109 | return 0; | 111 | return 0; |
110 | 112 | ||
@@ -137,9 +139,9 @@ static int journal_submit_commit_record(journal_t *journal, | |||
137 | if (journal->j_flags & JBD2_BARRIER && | 139 | if (journal->j_flags & JBD2_BARRIER && |
138 | !JBD2_HAS_INCOMPAT_FEATURE(journal, | 140 | !JBD2_HAS_INCOMPAT_FEATURE(journal, |
139 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) | 141 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) |
140 | ret = submit_bh(WRITE_SYNC_PLUG | WRITE_FLUSH_FUA, bh); | 142 | ret = submit_bh(WRITE_SYNC | WRITE_FLUSH_FUA, bh); |
141 | else | 143 | else |
142 | ret = submit_bh(WRITE_SYNC_PLUG, bh); | 144 | ret = submit_bh(WRITE_SYNC, bh); |
143 | 145 | ||
144 | *cbh = bh; | 146 | *cbh = bh; |
145 | return ret; | 147 | return ret; |
@@ -329,7 +331,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
329 | int tag_bytes = journal_tag_bytes(journal); | 331 | int tag_bytes = journal_tag_bytes(journal); |
330 | struct buffer_head *cbh = NULL; /* For transactional checksums */ | 332 | struct buffer_head *cbh = NULL; /* For transactional checksums */ |
331 | __u32 crc32_sum = ~0; | 333 | __u32 crc32_sum = ~0; |
332 | int write_op = WRITE_SYNC; | 334 | struct blk_plug plug; |
333 | 335 | ||
334 | /* | 336 | /* |
335 | * First job: lock down the current transaction and wait for | 337 | * First job: lock down the current transaction and wait for |
@@ -363,13 +365,6 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
363 | write_lock(&journal->j_state_lock); | 365 | write_lock(&journal->j_state_lock); |
364 | commit_transaction->t_state = T_LOCKED; | 366 | commit_transaction->t_state = T_LOCKED; |
365 | 367 | ||
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); | 368 | trace_jbd2_commit_locking(journal, commit_transaction); |
374 | stats.run.rs_wait = commit_transaction->t_max_wait; | 369 | stats.run.rs_wait = commit_transaction->t_max_wait; |
375 | stats.run.rs_locked = jiffies; | 370 | stats.run.rs_locked = jiffies; |
@@ -410,7 +405,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
410 | * we do not require it to remember exactly which old buffers it | 405 | * we do not require it to remember exactly which old buffers it |
411 | * has reserved. This is consistent with the existing behaviour | 406 | * has reserved. This is consistent with the existing behaviour |
412 | * that multiple jbd2_journal_get_write_access() calls to the same | 407 | * that multiple jbd2_journal_get_write_access() calls to the same |
413 | * buffer are perfectly permissable. | 408 | * buffer are perfectly permissible. |
414 | */ | 409 | */ |
415 | while (commit_transaction->t_reserved_list) { | 410 | while (commit_transaction->t_reserved_list) { |
416 | jh = commit_transaction->t_reserved_list; | 411 | jh = commit_transaction->t_reserved_list; |
@@ -469,8 +464,10 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
469 | if (err) | 464 | if (err) |
470 | jbd2_journal_abort(journal, err); | 465 | jbd2_journal_abort(journal, err); |
471 | 466 | ||
467 | blk_start_plug(&plug); | ||
472 | jbd2_journal_write_revoke_records(journal, commit_transaction, | 468 | jbd2_journal_write_revoke_records(journal, commit_transaction, |
473 | write_op); | 469 | WRITE_SYNC); |
470 | blk_finish_plug(&plug); | ||
474 | 471 | ||
475 | jbd_debug(3, "JBD: commit phase 2\n"); | 472 | jbd_debug(3, "JBD: commit phase 2\n"); |
476 | 473 | ||
@@ -497,6 +494,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
497 | err = 0; | 494 | err = 0; |
498 | descriptor = NULL; | 495 | descriptor = NULL; |
499 | bufs = 0; | 496 | bufs = 0; |
497 | blk_start_plug(&plug); | ||
500 | while (commit_transaction->t_buffers) { | 498 | while (commit_transaction->t_buffers) { |
501 | 499 | ||
502 | /* Find the next buffer to be journaled... */ | 500 | /* Find the next buffer to be journaled... */ |
@@ -658,7 +656,7 @@ start_journal_io: | |||
658 | clear_buffer_dirty(bh); | 656 | clear_buffer_dirty(bh); |
659 | set_buffer_uptodate(bh); | 657 | set_buffer_uptodate(bh); |
660 | bh->b_end_io = journal_end_buffer_io_sync; | 658 | bh->b_end_io = journal_end_buffer_io_sync; |
661 | submit_bh(write_op, bh); | 659 | submit_bh(WRITE_SYNC, bh); |
662 | } | 660 | } |
663 | cond_resched(); | 661 | cond_resched(); |
664 | stats.run.rs_blocks_logged += bufs; | 662 | stats.run.rs_blocks_logged += bufs; |
@@ -699,6 +697,8 @@ start_journal_io: | |||
699 | __jbd2_journal_abort_hard(journal); | 697 | __jbd2_journal_abort_hard(journal); |
700 | } | 698 | } |
701 | 699 | ||
700 | blk_finish_plug(&plug); | ||
701 | |||
702 | /* Lo and behold: we have just managed to send a transaction to | 702 | /* 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 | 703 | the log. Before we can commit it, wait for the IO so far to |
704 | complete. Control buffers being written are on the | 704 | complete. Control buffers being written are on the |
@@ -808,7 +808,7 @@ wait_for_iobuf: | |||
808 | if (err) | 808 | if (err) |
809 | __jbd2_journal_abort_hard(journal); | 809 | __jbd2_journal_abort_hard(journal); |
810 | } | 810 | } |
811 | if (!err && !is_journal_aborted(journal)) | 811 | if (cbh) |
812 | err = journal_wait_on_commit_record(journal, cbh); | 812 | err = journal_wait_on_commit_record(journal, cbh); |
813 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | 813 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, |
814 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) && | 814 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) && |