[<prev] [next>] [day] [month] [year] [list]
Message-ID: <47549174.7050808@redhat.com>
Date: Mon, 03 Dec 2007 17:29:56 -0600
From: Eric Sandeen <sandeen@...hat.com>
To: ext4 development <linux-ext4@...r.kernel.org>
Subject: [PATCH 3/4] ext4: accumulate jbd2 stats in jiffies
Accumulate jbd2 stats in jiffies not msecs, per akpm's suggestion.
Convert to msecs on when displayed.
jbd2_time_diff() should still be moved to a common header file.
Signed-off-by: Eric Sandeen <sandeen@...hat.com>
---
Index: linux-2.6.24-rc3/fs/jbd2/checkpoint.c
===================================================================
--- linux-2.6.24-rc3.orig/fs/jbd2/checkpoint.c
+++ linux-2.6.24-rc3/fs/jbd2/checkpoint.c
@@ -326,7 +326,7 @@ int jbd2_log_do_checkpoint(journal_t *jo
goto out;
transaction = journal->j_checkpoint_transactions;
if (transaction->t_chp_stats.cs_chp_time == 0)
- transaction->t_chp_stats.cs_chp_time = CURRENT_MSECS;
+ transaction->t_chp_stats.cs_chp_time = jiffies;
this_tid = transaction->t_tid;
restart:
/*
Index: linux-2.6.24-rc3/fs/jbd2/commit.c
===================================================================
--- linux-2.6.24-rc3.orig/fs/jbd2/commit.c
+++ linux-2.6.24-rc3/fs/jbd2/commit.c
@@ -340,7 +340,7 @@ void jbd2_journal_commit_transaction(jou
commit_transaction->t_state = T_LOCKED;
stats.ts_wait = commit_transaction->t_max_wait;
- stats.ts_locked = CURRENT_MSECS;
+ stats.ts_locked = jiffies;
stats.ts_running = jbd2_time_diff(commit_transaction->t_start,
stats.ts_locked);
@@ -414,7 +414,7 @@ void jbd2_journal_commit_transaction(jou
*/
jbd2_journal_switch_revoke_table(journal);
- stats.ts_flushing = CURRENT_MSECS;
+ stats.ts_flushing = jiffies;
stats.ts_locked = jbd2_time_diff(stats.ts_locked, stats.ts_flushing);
commit_transaction->t_state = T_FLUSH;
@@ -508,7 +508,7 @@ void jbd2_journal_commit_transaction(jou
*/
commit_transaction->t_state = T_COMMIT;
- stats.ts_logging = CURRENT_MSECS;
+ stats.ts_logging = jiffies;
stats.ts_flushing = jbd2_time_diff(stats.ts_flushing, stats.ts_logging);
stats.ts_blocks = commit_transaction->t_outstanding_credits;
stats.ts_blocks_logged = 0;
@@ -907,7 +907,7 @@ restart_loop:
J_ASSERT(commit_transaction->t_state == T_COMMIT);
- commit_transaction->t_start = CURRENT_MSECS;
+ commit_transaction->t_start = jiffies;
stats.ts_logging = jbd2_time_diff(stats.ts_logging,
commit_transaction->t_start);
Index: linux-2.6.24-rc3/fs/jbd2/transaction.c
===================================================================
--- linux-2.6.24-rc3.orig/fs/jbd2/transaction.c
+++ linux-2.6.24-rc3/fs/jbd2/transaction.c
@@ -60,7 +60,7 @@ jbd2_get_transaction(journal_t *journal,
J_ASSERT(journal->j_running_transaction == NULL);
journal->j_running_transaction = transaction;
transaction->t_max_wait = 0;
- transaction->t_start = CURRENT_MSECS;
+ transaction->t_start = jiffies;
return transaction;
}
@@ -87,7 +87,7 @@ static int start_this_handle(journal_t *
int nblocks = handle->h_buffer_credits;
transaction_t *new_transaction = NULL;
int ret = 0;
- unsigned long ts = CURRENT_MSECS;
+ unsigned long ts = jiffies;
if (nblocks > journal->j_max_transaction_buffers) {
printk(KERN_ERR "JBD: %s wants too many credits (%d > %d)\n",
Index: linux-2.6.24-rc3/include/linux/jbd2.h
===================================================================
--- linux-2.6.24-rc3.orig/include/linux/jbd2.h
+++ linux-2.6.24-rc3/include/linux/jbd2.h
@@ -626,16 +626,13 @@ struct transaction_stats_s
#define ts_written u.chp.cs_written
#define ts_dropped u.chp.cs_dropped
-#define CURRENT_MSECS (jiffies_to_msecs(jiffies))
-
-static inline unsigned int
-jbd2_time_diff(unsigned int start, unsigned int end)
+static inline unsigned long
+jbd2_time_diff(unsigned long start, unsigned long end)
{
- if (unlikely(start > end))
- end = end + (~0UL - start);
- else
- end -= start;
- return end;
+ if (end >= start)
+ return end - start;
+
+ return end + (MAX_JIFFY_OFFSET - start);
}
/**
Index: linux-2.6.24-rc3/fs/jbd2/journal.c
===================================================================
--- linux-2.6.24-rc3.orig/fs/jbd2/journal.c
+++ linux-2.6.24-rc3/fs/jbd2/journal.c
@@ -712,15 +712,19 @@ static int jbd2_seq_history_show(struct
return 0;
}
if (ts->ts_type == JBD2_STATS_RUN)
- seq_printf(seq, "%-4s %-5lu %-5lu %-5lu %-5lu %-5lu %-5lu "
+ seq_printf(seq, "%-4s %-5lu %-5u %-5u %-5u %-5u %-5u "
"%-6lu %-5lu %-5lu\n", "R", ts->ts_tid,
- ts->ts_wait, ts->ts_running, ts->ts_locked,
- ts->ts_flushing, ts->ts_logging,
+ jiffies_to_msecs(ts->ts_wait),
+ jiffies_to_msecs(ts->ts_running),
+ jiffies_to_msecs(ts->ts_locked),
+ jiffies_to_msecs(ts->ts_flushing),
+ jiffies_to_msecs(ts->ts_logging),
ts->ts_handle_count, ts->ts_blocks,
ts->ts_blocks_logged);
else if (ts->ts_type == JBD2_STATS_CHECKPOINT)
- seq_printf(seq, "%-4s %-5lu %48s %-5lu %-5lu %-5lu %-5lu\n",
- "C", ts->ts_tid, " ", ts->ts_chp_time,
+ seq_printf(seq, "%-4s %-5lu %48s %-5u %-5lu %-5lu %-5lu\n",
+ "C", ts->ts_tid, " ",
+ jiffies_to_msecs(ts->ts_chp_time),
ts->ts_written, ts->ts_dropped,
ts->ts_forced_to_close);
else
@@ -812,21 +816,21 @@ static int jbd2_seq_info_show(struct seq
if (s->stats->ts_tid == 0)
return 0;
seq_printf(seq, "average: \n %lums waiting for transaction\n",
- s->stats->ts_wait / s->stats->ts_tid);
+ jiffies_to_msecs(s->stats->ts_wait / s->stats->ts_tid));
seq_printf(seq, " %lums running transaction\n",
- s->stats->ts_running / s->stats->ts_tid);
+ jiffies_to_msecs(s->stats->ts_running / s->stats->ts_tid));
seq_printf(seq, " %lums transaction was being locked\n",
- s->stats->ts_locked / s->stats->ts_tid);
+ jiffies_to_msecs(s->stats->ts_locked / s->stats->ts_tid));
seq_printf(seq, " %lums flushing data (in ordered mode)\n",
- s->stats->ts_flushing / s->stats->ts_tid);
+ jiffies_to_msecs(s->stats->ts_flushing / s->stats->ts_tid));
seq_printf(seq, " %lums logging transaction\n",
- s->stats->ts_logging / s->stats->ts_tid);
+ jiffies_to_msecs(s->stats->ts_logging / s->stats->ts_tid));
seq_printf(seq, " %lu handles per transaction\n",
- s->stats->ts_handle_count / s->stats->ts_tid);
+ s->stats->ts_handle_count / s->stats->ts_tid);
seq_printf(seq, " %lu blocks per transaction\n",
- s->stats->ts_blocks / s->stats->ts_tid);
+ s->stats->ts_blocks / s->stats->ts_tid);
seq_printf(seq, " %lu logged blocks per transaction\n",
- s->stats->ts_blocks_logged / s->stats->ts_tid);
+ s->stats->ts_blocks_logged / s->stats->ts_tid);
return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists