diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-11-03 01:10:07 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-11-03 01:10:07 -0500 |
commit | 7a53c7f56bbfc9b0ef892e68f5cfae3d902544d1 (patch) | |
tree | 19dec256fc80ad06d631ece78b9eb68a457ce66b /fs/jbd2/commit.c | |
parent | e57130698fe3dd2b7d617d90bbf86474473cb40c (diff) | |
parent | 012abeea669ea49636cf952d13298bb68654146a (diff) |
Merge commit 'v2.6.32-rc5' into for-linus
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r-- | fs/jbd2/commit.c | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 7b4088b2364d..d4cfd6d2779e 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/writeback.h> | 25 | #include <linux/writeback.h> |
26 | #include <linux/backing-dev.h> | 26 | #include <linux/backing-dev.h> |
27 | #include <linux/bio.h> | 27 | #include <linux/bio.h> |
28 | #include <linux/blkdev.h> | ||
28 | #include <trace/events/jbd2.h> | 29 | #include <trace/events/jbd2.h> |
29 | 30 | ||
30 | /* | 31 | /* |
@@ -133,8 +134,8 @@ static int journal_submit_commit_record(journal_t *journal, | |||
133 | bh->b_end_io = journal_end_buffer_io_sync; | 134 | bh->b_end_io = journal_end_buffer_io_sync; |
134 | 135 | ||
135 | if (journal->j_flags & JBD2_BARRIER && | 136 | if (journal->j_flags & JBD2_BARRIER && |
136 | !JBD2_HAS_INCOMPAT_FEATURE(journal, | 137 | !JBD2_HAS_INCOMPAT_FEATURE(journal, |
137 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { | 138 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { |
138 | set_buffer_ordered(bh); | 139 | set_buffer_ordered(bh); |
139 | barrier_done = 1; | 140 | barrier_done = 1; |
140 | } | 141 | } |
@@ -220,7 +221,6 @@ static int journal_submit_inode_data_buffers(struct address_space *mapping) | |||
220 | .nr_to_write = mapping->nrpages * 2, | 221 | .nr_to_write = mapping->nrpages * 2, |
221 | .range_start = 0, | 222 | .range_start = 0, |
222 | .range_end = i_size_read(mapping->host), | 223 | .range_end = i_size_read(mapping->host), |
223 | .for_writepages = 1, | ||
224 | }; | 224 | }; |
225 | 225 | ||
226 | ret = generic_writepages(mapping, &wbc); | 226 | ret = generic_writepages(mapping, &wbc); |
@@ -410,10 +410,10 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
410 | if (commit_transaction->t_synchronous_commit) | 410 | if (commit_transaction->t_synchronous_commit) |
411 | write_op = WRITE_SYNC_PLUG; | 411 | write_op = WRITE_SYNC_PLUG; |
412 | trace_jbd2_commit_locking(journal, commit_transaction); | 412 | trace_jbd2_commit_locking(journal, commit_transaction); |
413 | stats.u.run.rs_wait = commit_transaction->t_max_wait; | 413 | stats.run.rs_wait = commit_transaction->t_max_wait; |
414 | stats.u.run.rs_locked = jiffies; | 414 | stats.run.rs_locked = jiffies; |
415 | stats.u.run.rs_running = jbd2_time_diff(commit_transaction->t_start, | 415 | stats.run.rs_running = jbd2_time_diff(commit_transaction->t_start, |
416 | stats.u.run.rs_locked); | 416 | stats.run.rs_locked); |
417 | 417 | ||
418 | spin_lock(&commit_transaction->t_handle_lock); | 418 | spin_lock(&commit_transaction->t_handle_lock); |
419 | while (commit_transaction->t_updates) { | 419 | while (commit_transaction->t_updates) { |
@@ -486,9 +486,9 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
486 | jbd2_journal_switch_revoke_table(journal); | 486 | jbd2_journal_switch_revoke_table(journal); |
487 | 487 | ||
488 | trace_jbd2_commit_flushing(journal, commit_transaction); | 488 | trace_jbd2_commit_flushing(journal, commit_transaction); |
489 | stats.u.run.rs_flushing = jiffies; | 489 | stats.run.rs_flushing = jiffies; |
490 | stats.u.run.rs_locked = jbd2_time_diff(stats.u.run.rs_locked, | 490 | stats.run.rs_locked = jbd2_time_diff(stats.run.rs_locked, |
491 | stats.u.run.rs_flushing); | 491 | stats.run.rs_flushing); |
492 | 492 | ||
493 | commit_transaction->t_state = T_FLUSH; | 493 | commit_transaction->t_state = T_FLUSH; |
494 | journal->j_committing_transaction = commit_transaction; | 494 | journal->j_committing_transaction = commit_transaction; |
@@ -523,11 +523,11 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
523 | spin_unlock(&journal->j_state_lock); | 523 | spin_unlock(&journal->j_state_lock); |
524 | 524 | ||
525 | trace_jbd2_commit_logging(journal, commit_transaction); | 525 | trace_jbd2_commit_logging(journal, commit_transaction); |
526 | stats.u.run.rs_logging = jiffies; | 526 | stats.run.rs_logging = jiffies; |
527 | stats.u.run.rs_flushing = jbd2_time_diff(stats.u.run.rs_flushing, | 527 | stats.run.rs_flushing = jbd2_time_diff(stats.run.rs_flushing, |
528 | stats.u.run.rs_logging); | 528 | stats.run.rs_logging); |
529 | stats.u.run.rs_blocks = commit_transaction->t_outstanding_credits; | 529 | stats.run.rs_blocks = commit_transaction->t_outstanding_credits; |
530 | stats.u.run.rs_blocks_logged = 0; | 530 | stats.run.rs_blocks_logged = 0; |
531 | 531 | ||
532 | J_ASSERT(commit_transaction->t_nr_buffers <= | 532 | J_ASSERT(commit_transaction->t_nr_buffers <= |
533 | commit_transaction->t_outstanding_credits); | 533 | commit_transaction->t_outstanding_credits); |
@@ -695,7 +695,7 @@ start_journal_io: | |||
695 | submit_bh(write_op, bh); | 695 | submit_bh(write_op, bh); |
696 | } | 696 | } |
697 | cond_resched(); | 697 | cond_resched(); |
698 | stats.u.run.rs_blocks_logged += bufs; | 698 | stats.run.rs_blocks_logged += bufs; |
699 | 699 | ||
700 | /* Force a new descriptor to be generated next | 700 | /* Force a new descriptor to be generated next |
701 | time round the loop. */ | 701 | time round the loop. */ |
@@ -707,11 +707,13 @@ start_journal_io: | |||
707 | /* Done it all: now write the commit record asynchronously. */ | 707 | /* Done it all: now write the commit record asynchronously. */ |
708 | 708 | ||
709 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | 709 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, |
710 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { | 710 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { |
711 | err = journal_submit_commit_record(journal, commit_transaction, | 711 | err = journal_submit_commit_record(journal, commit_transaction, |
712 | &cbh, crc32_sum); | 712 | &cbh, crc32_sum); |
713 | if (err) | 713 | if (err) |
714 | __jbd2_journal_abort_hard(journal); | 714 | __jbd2_journal_abort_hard(journal); |
715 | if (journal->j_flags & JBD2_BARRIER) | ||
716 | blkdev_issue_flush(journal->j_dev, NULL); | ||
715 | } | 717 | } |
716 | 718 | ||
717 | /* | 719 | /* |
@@ -834,7 +836,7 @@ wait_for_iobuf: | |||
834 | jbd_debug(3, "JBD: commit phase 5\n"); | 836 | jbd_debug(3, "JBD: commit phase 5\n"); |
835 | 837 | ||
836 | if (!JBD2_HAS_INCOMPAT_FEATURE(journal, | 838 | if (!JBD2_HAS_INCOMPAT_FEATURE(journal, |
837 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { | 839 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { |
838 | err = journal_submit_commit_record(journal, commit_transaction, | 840 | err = journal_submit_commit_record(journal, commit_transaction, |
839 | &cbh, crc32_sum); | 841 | &cbh, crc32_sum); |
840 | if (err) | 842 | if (err) |
@@ -986,33 +988,30 @@ restart_loop: | |||
986 | J_ASSERT(commit_transaction->t_state == T_COMMIT); | 988 | J_ASSERT(commit_transaction->t_state == T_COMMIT); |
987 | 989 | ||
988 | commit_transaction->t_start = jiffies; | 990 | commit_transaction->t_start = jiffies; |
989 | stats.u.run.rs_logging = jbd2_time_diff(stats.u.run.rs_logging, | 991 | stats.run.rs_logging = jbd2_time_diff(stats.run.rs_logging, |
990 | commit_transaction->t_start); | 992 | commit_transaction->t_start); |
991 | 993 | ||
992 | /* | 994 | /* |
993 | * File the transaction for history | 995 | * File the transaction statistics |
994 | */ | 996 | */ |
995 | stats.ts_type = JBD2_STATS_RUN; | ||
996 | stats.ts_tid = commit_transaction->t_tid; | 997 | stats.ts_tid = commit_transaction->t_tid; |
997 | stats.u.run.rs_handle_count = commit_transaction->t_handle_count; | 998 | stats.run.rs_handle_count = commit_transaction->t_handle_count; |
998 | spin_lock(&journal->j_history_lock); | 999 | trace_jbd2_run_stats(journal->j_fs_dev->bd_dev, |
999 | memcpy(journal->j_history + journal->j_history_cur, &stats, | 1000 | commit_transaction->t_tid, &stats.run); |
1000 | sizeof(stats)); | ||
1001 | if (++journal->j_history_cur == journal->j_history_max) | ||
1002 | journal->j_history_cur = 0; | ||
1003 | 1001 | ||
1004 | /* | 1002 | /* |
1005 | * Calculate overall stats | 1003 | * Calculate overall stats |
1006 | */ | 1004 | */ |
1005 | spin_lock(&journal->j_history_lock); | ||
1007 | journal->j_stats.ts_tid++; | 1006 | journal->j_stats.ts_tid++; |
1008 | journal->j_stats.u.run.rs_wait += stats.u.run.rs_wait; | 1007 | journal->j_stats.run.rs_wait += stats.run.rs_wait; |
1009 | journal->j_stats.u.run.rs_running += stats.u.run.rs_running; | 1008 | journal->j_stats.run.rs_running += stats.run.rs_running; |
1010 | journal->j_stats.u.run.rs_locked += stats.u.run.rs_locked; | 1009 | journal->j_stats.run.rs_locked += stats.run.rs_locked; |
1011 | journal->j_stats.u.run.rs_flushing += stats.u.run.rs_flushing; | 1010 | journal->j_stats.run.rs_flushing += stats.run.rs_flushing; |
1012 | journal->j_stats.u.run.rs_logging += stats.u.run.rs_logging; | 1011 | journal->j_stats.run.rs_logging += stats.run.rs_logging; |
1013 | journal->j_stats.u.run.rs_handle_count += stats.u.run.rs_handle_count; | 1012 | journal->j_stats.run.rs_handle_count += stats.run.rs_handle_count; |
1014 | journal->j_stats.u.run.rs_blocks += stats.u.run.rs_blocks; | 1013 | journal->j_stats.run.rs_blocks += stats.run.rs_blocks; |
1015 | journal->j_stats.u.run.rs_blocks_logged += stats.u.run.rs_blocks_logged; | 1014 | journal->j_stats.run.rs_blocks_logged += stats.run.rs_blocks_logged; |
1016 | spin_unlock(&journal->j_history_lock); | 1015 | spin_unlock(&journal->j_history_lock); |
1017 | 1016 | ||
1018 | commit_transaction->t_state = T_FINISHED; | 1017 | commit_transaction->t_state = T_FINISHED; |