diff options
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r-- | fs/jbd2/commit.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 6393fd0d804e..f22d1828ea85 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -355,6 +355,8 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
355 | int flags; | 355 | int flags; |
356 | int err; | 356 | int err; |
357 | unsigned long long blocknr; | 357 | unsigned long long blocknr; |
358 | ktime_t start_time; | ||
359 | u64 commit_time; | ||
358 | char *tagp = NULL; | 360 | char *tagp = NULL; |
359 | journal_header_t *header; | 361 | journal_header_t *header; |
360 | journal_block_tag_t *tag = NULL; | 362 | journal_block_tag_t *tag = NULL; |
@@ -481,6 +483,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
481 | commit_transaction->t_state = T_FLUSH; | 483 | commit_transaction->t_state = T_FLUSH; |
482 | journal->j_committing_transaction = commit_transaction; | 484 | journal->j_committing_transaction = commit_transaction; |
483 | journal->j_running_transaction = NULL; | 485 | journal->j_running_transaction = NULL; |
486 | start_time = ktime_get(); | ||
484 | commit_transaction->t_log_start = journal->j_head; | 487 | commit_transaction->t_log_start = journal->j_head; |
485 | wake_up(&journal->j_wait_transaction_locked); | 488 | wake_up(&journal->j_wait_transaction_locked); |
486 | spin_unlock(&journal->j_state_lock); | 489 | spin_unlock(&journal->j_state_lock); |
@@ -995,6 +998,17 @@ restart_loop: | |||
995 | J_ASSERT(commit_transaction == journal->j_committing_transaction); | 998 | J_ASSERT(commit_transaction == journal->j_committing_transaction); |
996 | journal->j_commit_sequence = commit_transaction->t_tid; | 999 | journal->j_commit_sequence = commit_transaction->t_tid; |
997 | journal->j_committing_transaction = NULL; | 1000 | journal->j_committing_transaction = NULL; |
1001 | commit_time = ktime_to_ns(ktime_sub(ktime_get(), start_time)); | ||
1002 | |||
1003 | /* | ||
1004 | * weight the commit time higher than the average time so we don't | ||
1005 | * react too strongly to vast changes in the commit time | ||
1006 | */ | ||
1007 | if (likely(journal->j_average_commit_time)) | ||
1008 | journal->j_average_commit_time = (commit_time + | ||
1009 | journal->j_average_commit_time*3) / 4; | ||
1010 | else | ||
1011 | journal->j_average_commit_time = commit_time; | ||
998 | spin_unlock(&journal->j_state_lock); | 1012 | spin_unlock(&journal->j_state_lock); |
999 | 1013 | ||
1000 | if (journal->j_commit_callback) | 1014 | if (journal->j_commit_callback) |