aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2013-02-06 22:30:23 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-02-06 22:30:23 -0500
commit9fff24aa2c5c504aadead1ff9599e813604c2e53 (patch)
tree24bbb1691ec816aed648a895882526ce361ec92f /fs/jbd2
parent40ae3487628235e5f1eb27542cca0cdb6e5dbe16 (diff)
jbd2: track request delay statistics
Track the delay between when we first request that the commit begin and when it actually begins, so we can see how much of a gap exists. In theory, this should just be the remaining scheduling quantuum of the thread which requested the commit (assuming it was not a synchronous operation which triggered the commit request) plus scheduling overhead; however, it's possible that real time processes might get in the way of letting the kjournald thread from executing. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/jbd2')
-rw-r--r--fs/jbd2/commit.c8
-rw-r--r--fs/jbd2/journal.c12
-rw-r--r--fs/jbd2/transaction.c1
3 files changed, 18 insertions, 3 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 3091d42992f0..750c70148eff 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -435,7 +435,12 @@ void jbd2_journal_commit_transaction(journal_t *journal)
435 435
436 trace_jbd2_commit_locking(journal, commit_transaction); 436 trace_jbd2_commit_locking(journal, commit_transaction);
437 stats.run.rs_wait = commit_transaction->t_max_wait; 437 stats.run.rs_wait = commit_transaction->t_max_wait;
438 stats.run.rs_request_delay = 0;
438 stats.run.rs_locked = jiffies; 439 stats.run.rs_locked = jiffies;
440 if (commit_transaction->t_requested)
441 stats.run.rs_request_delay =
442 jbd2_time_diff(commit_transaction->t_requested,
443 stats.run.rs_locked);
439 stats.run.rs_running = jbd2_time_diff(commit_transaction->t_start, 444 stats.run.rs_running = jbd2_time_diff(commit_transaction->t_start,
440 stats.run.rs_locked); 445 stats.run.rs_locked);
441 446
@@ -1116,7 +1121,10 @@ restart_loop:
1116 */ 1121 */
1117 spin_lock(&journal->j_history_lock); 1122 spin_lock(&journal->j_history_lock);
1118 journal->j_stats.ts_tid++; 1123 journal->j_stats.ts_tid++;
1124 if (commit_transaction->t_requested)
1125 journal->j_stats.ts_requested++;
1119 journal->j_stats.run.rs_wait += stats.run.rs_wait; 1126 journal->j_stats.run.rs_wait += stats.run.rs_wait;
1127 journal->j_stats.run.rs_request_delay += stats.run.rs_request_delay;
1120 journal->j_stats.run.rs_running += stats.run.rs_running; 1128 journal->j_stats.run.rs_running += stats.run.rs_running;
1121 journal->j_stats.run.rs_locked += stats.run.rs_locked; 1129 journal->j_stats.run.rs_locked += stats.run.rs_locked;
1122 journal->j_stats.run.rs_flushing += stats.run.rs_flushing; 1130 journal->j_stats.run.rs_flushing += stats.run.rs_flushing;
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 1a80e3146a59..4ba2e81e35ac 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -533,6 +533,7 @@ int __jbd2_log_start_commit(journal_t *journal, tid_t target)
533 jbd_debug(1, "JBD2: requesting commit %d/%d\n", 533 jbd_debug(1, "JBD2: requesting commit %d/%d\n",
534 journal->j_commit_request, 534 journal->j_commit_request,
535 journal->j_commit_sequence); 535 journal->j_commit_sequence);
536 journal->j_running_transaction->t_requested = jiffies;
536 wake_up(&journal->j_wait_commit); 537 wake_up(&journal->j_wait_commit);
537 return 1; 538 return 1;
538 } else if (!tid_geq(journal->j_commit_request, target)) 539 } else if (!tid_geq(journal->j_commit_request, target))
@@ -898,13 +899,18 @@ static int jbd2_seq_info_show(struct seq_file *seq, void *v)
898 899
899 if (v != SEQ_START_TOKEN) 900 if (v != SEQ_START_TOKEN)
900 return 0; 901 return 0;
901 seq_printf(seq, "%lu transaction, each up to %u blocks\n", 902 seq_printf(seq, "%lu transactions (%lu requested), "
902 s->stats->ts_tid, 903 "each up to %u blocks\n",
903 s->journal->j_max_transaction_buffers); 904 s->stats->ts_tid, s->stats->ts_requested,
905 s->journal->j_max_transaction_buffers);
904 if (s->stats->ts_tid == 0) 906 if (s->stats->ts_tid == 0)
905 return 0; 907 return 0;
906 seq_printf(seq, "average: \n %ums waiting for transaction\n", 908 seq_printf(seq, "average: \n %ums waiting for transaction\n",
907 jiffies_to_msecs(s->stats->run.rs_wait / s->stats->ts_tid)); 909 jiffies_to_msecs(s->stats->run.rs_wait / s->stats->ts_tid));
910 seq_printf(seq, " %ums request delay\n",
911 (s->stats->ts_requested == 0) ? 0 :
912 jiffies_to_msecs(s->stats->run.rs_request_delay /
913 s->stats->ts_requested));
908 seq_printf(seq, " %ums running transaction\n", 914 seq_printf(seq, " %ums running transaction\n",
909 jiffies_to_msecs(s->stats->run.rs_running / s->stats->ts_tid)); 915 jiffies_to_msecs(s->stats->run.rs_running / s->stats->ts_tid));
910 seq_printf(seq, " %ums transaction was being locked\n", 916 seq_printf(seq, " %ums transaction was being locked\n",
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index df9f29760efa..735609e2d636 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -100,6 +100,7 @@ jbd2_get_transaction(journal_t *journal, transaction_t *transaction)
100 journal->j_running_transaction = transaction; 100 journal->j_running_transaction = transaction;
101 transaction->t_max_wait = 0; 101 transaction->t_max_wait = 0;
102 transaction->t_start = jiffies; 102 transaction->t_start = jiffies;
103 transaction->t_requested = 0;
103 104
104 return transaction; 105 return transaction;
105} 106}