diff options
Diffstat (limited to 'fs/jbd2/commit.c')
| -rw-r--r-- | fs/jbd2/commit.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 39b5cee3dd8a..8749a86f4175 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
| 21 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
| 22 | #include <linux/pagemap.h> | 22 | #include <linux/pagemap.h> |
| 23 | #include <linux/jiffies.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. |
| @@ -290,6 +291,7 @@ static inline void write_tag_block(int tag_bytes, journal_block_tag_t *tag, | |||
| 290 | */ | 291 | */ |
| 291 | void jbd2_journal_commit_transaction(journal_t *journal) | 292 | void jbd2_journal_commit_transaction(journal_t *journal) |
| 292 | { | 293 | { |
| 294 | struct transaction_stats_s stats; | ||
| 293 | transaction_t *commit_transaction; | 295 | transaction_t *commit_transaction; |
| 294 | struct journal_head *jh, *new_jh, *descriptor; | 296 | struct journal_head *jh, *new_jh, *descriptor; |
| 295 | struct buffer_head **wbuf = journal->j_wbuf; | 297 | struct buffer_head **wbuf = journal->j_wbuf; |
| @@ -337,6 +339,11 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
| 337 | spin_lock(&journal->j_state_lock); | 339 | spin_lock(&journal->j_state_lock); |
| 338 | commit_transaction->t_state = T_LOCKED; | 340 | commit_transaction->t_state = T_LOCKED; |
| 339 | 341 | ||
| 342 | stats.u.run.rs_wait = commit_transaction->t_max_wait; | ||
| 343 | stats.u.run.rs_locked = jiffies; | ||
| 344 | stats.u.run.rs_running = jbd2_time_diff(commit_transaction->t_start, | ||
| 345 | stats.u.run.rs_locked); | ||
| 346 | |||
| 340 | spin_lock(&commit_transaction->t_handle_lock); | 347 | spin_lock(&commit_transaction->t_handle_lock); |
| 341 | while (commit_transaction->t_updates) { | 348 | while (commit_transaction->t_updates) { |
| 342 | DEFINE_WAIT(wait); | 349 | DEFINE_WAIT(wait); |
| @@ -407,6 +414,10 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
| 407 | */ | 414 | */ |
| 408 | jbd2_journal_switch_revoke_table(journal); | 415 | jbd2_journal_switch_revoke_table(journal); |
| 409 | 416 | ||
| 417 | stats.u.run.rs_flushing = jiffies; | ||
| 418 | stats.u.run.rs_locked = jbd2_time_diff(stats.u.run.rs_locked, | ||
| 419 | stats.u.run.rs_flushing); | ||
| 420 | |||
| 410 | commit_transaction->t_state = T_FLUSH; | 421 | commit_transaction->t_state = T_FLUSH; |
| 411 | journal->j_committing_transaction = commit_transaction; | 422 | journal->j_committing_transaction = commit_transaction; |
| 412 | journal->j_running_transaction = NULL; | 423 | journal->j_running_transaction = NULL; |
| @@ -498,6 +509,12 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
| 498 | */ | 509 | */ |
| 499 | commit_transaction->t_state = T_COMMIT; | 510 | commit_transaction->t_state = T_COMMIT; |
| 500 | 511 | ||
| 512 | stats.u.run.rs_logging = jiffies; | ||
| 513 | stats.u.run.rs_flushing = jbd2_time_diff(stats.u.run.rs_flushing, | ||
| 514 | stats.u.run.rs_logging); | ||
| 515 | stats.u.run.rs_blocks = commit_transaction->t_outstanding_credits; | ||
| 516 | stats.u.run.rs_blocks_logged = 0; | ||
| 517 | |||
| 501 | descriptor = NULL; | 518 | descriptor = NULL; |
| 502 | bufs = 0; | 519 | bufs = 0; |
| 503 | while (commit_transaction->t_buffers) { | 520 | while (commit_transaction->t_buffers) { |
| @@ -646,6 +663,7 @@ start_journal_io: | |||
| 646 | submit_bh(WRITE, bh); | 663 | submit_bh(WRITE, bh); |
| 647 | } | 664 | } |
| 648 | cond_resched(); | 665 | cond_resched(); |
| 666 | stats.u.run.rs_blocks_logged += bufs; | ||
| 649 | 667 | ||
| 650 | /* Force a new descriptor to be generated next | 668 | /* Force a new descriptor to be generated next |
| 651 | time round the loop. */ | 669 | time round the loop. */ |
| @@ -816,6 +834,7 @@ restart_loop: | |||
| 816 | cp_transaction = jh->b_cp_transaction; | 834 | cp_transaction = jh->b_cp_transaction; |
| 817 | if (cp_transaction) { | 835 | if (cp_transaction) { |
| 818 | JBUFFER_TRACE(jh, "remove from old cp transaction"); | 836 | JBUFFER_TRACE(jh, "remove from old cp transaction"); |
| 837 | cp_transaction->t_chp_stats.cs_dropped++; | ||
| 819 | __jbd2_journal_remove_checkpoint(jh); | 838 | __jbd2_journal_remove_checkpoint(jh); |
| 820 | } | 839 | } |
| 821 | 840 | ||
| @@ -890,6 +909,36 @@ restart_loop: | |||
| 890 | 909 | ||
| 891 | J_ASSERT(commit_transaction->t_state == T_COMMIT); | 910 | J_ASSERT(commit_transaction->t_state == T_COMMIT); |
| 892 | 911 | ||
| 912 | commit_transaction->t_start = jiffies; | ||
| 913 | stats.u.run.rs_logging = jbd2_time_diff(stats.u.run.rs_logging, | ||
| 914 | commit_transaction->t_start); | ||
| 915 | |||
| 916 | /* | ||
| 917 | * File the transaction for history | ||
| 918 | */ | ||
| 919 | stats.ts_type = JBD2_STATS_RUN; | ||
| 920 | stats.ts_tid = commit_transaction->t_tid; | ||
| 921 | stats.u.run.rs_handle_count = commit_transaction->t_handle_count; | ||
| 922 | spin_lock(&journal->j_history_lock); | ||
| 923 | memcpy(journal->j_history + journal->j_history_cur, &stats, | ||
| 924 | sizeof(stats)); | ||
| 925 | if (++journal->j_history_cur == journal->j_history_max) | ||
| 926 | journal->j_history_cur = 0; | ||
| 927 | |||
| 928 | /* | ||
| 929 | * Calculate overall stats | ||
| 930 | */ | ||
| 931 | journal->j_stats.ts_tid++; | ||
| 932 | journal->j_stats.u.run.rs_wait += stats.u.run.rs_wait; | ||
| 933 | journal->j_stats.u.run.rs_running += stats.u.run.rs_running; | ||
| 934 | journal->j_stats.u.run.rs_locked += stats.u.run.rs_locked; | ||
| 935 | journal->j_stats.u.run.rs_flushing += stats.u.run.rs_flushing; | ||
| 936 | journal->j_stats.u.run.rs_logging += stats.u.run.rs_logging; | ||
| 937 | journal->j_stats.u.run.rs_handle_count += stats.u.run.rs_handle_count; | ||
| 938 | journal->j_stats.u.run.rs_blocks += stats.u.run.rs_blocks; | ||
| 939 | journal->j_stats.u.run.rs_blocks_logged += stats.u.run.rs_blocks_logged; | ||
| 940 | spin_unlock(&journal->j_history_lock); | ||
| 941 | |||
| 893 | commit_transaction->t_state = T_FINISHED; | 942 | commit_transaction->t_state = T_FINISHED; |
| 894 | J_ASSERT(commit_transaction == journal->j_committing_transaction); | 943 | J_ASSERT(commit_transaction == journal->j_committing_transaction); |
| 895 | journal->j_commit_sequence = commit_transaction->t_tid; | 944 | journal->j_commit_sequence = commit_transaction->t_tid; |
