[<prev] [next>] [day] [month] [year] [list]
Message-ID: <47549184.5090908@redhat.com>
Date: Mon, 03 Dec 2007 17:30:12 -0600
From: Eric Sandeen <sandeen@...hat.com>
To: ext4 development <linux-ext4@...r.kernel.org>
Subject: [PATCH 4/4] ext4: open-code jbd2 stats union references
open-code references to stats unions for clarity, as suggested
by akpm on his review.
Signed-off-by: Eric Sandeen <sandeen@...hat.com>
---
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
@@ -339,10 +339,10 @@ void jbd2_journal_commit_transaction(jou
spin_lock(&journal->j_state_lock);
commit_transaction->t_state = T_LOCKED;
- stats.ts_wait = commit_transaction->t_max_wait;
- stats.ts_locked = jiffies;
- stats.ts_running = jbd2_time_diff(commit_transaction->t_start,
- stats.ts_locked);
+ stats.u.run.rs_wait = commit_transaction->t_max_wait;
+ stats.u.run.rs_locked = jiffies;
+ stats.u.run.rs_running = jbd2_time_diff(commit_transaction->t_start,
+ stats.u.run.rs_locked);
spin_lock(&commit_transaction->t_handle_lock);
while (commit_transaction->t_updates) {
@@ -414,8 +414,9 @@ void jbd2_journal_commit_transaction(jou
*/
jbd2_journal_switch_revoke_table(journal);
- stats.ts_flushing = jiffies;
- stats.ts_locked = jbd2_time_diff(stats.ts_locked, stats.ts_flushing);
+ stats.u.run.rs_flushing = jiffies;
+ stats.u.run.rs_locked = jbd2_time_diff(stats.u.run.rs_locked,
+ stats.u.run.rs_flushing);
commit_transaction->t_state = T_FLUSH;
journal->j_committing_transaction = commit_transaction;
@@ -508,10 +509,11 @@ void jbd2_journal_commit_transaction(jou
*/
commit_transaction->t_state = T_COMMIT;
- 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;
+ stats.u.run.rs_logging = jiffies;
+ stats.u.run.rs_flushing = jbd2_time_diff(stats.u.run.rs_flushing,
+ stats.u.run.rs_logging);
+ stats.u.run.rs_blocks = commit_transaction->t_outstanding_credits;
+ stats.u.run.rs_blocks_logged = 0;
descriptor = NULL;
bufs = 0;
@@ -661,7 +663,7 @@ start_journal_io:
submit_bh(WRITE, bh);
}
cond_resched();
- stats.ts_blocks_logged += bufs;
+ stats.u.run.rs_blocks_logged += bufs;
/* Force a new descriptor to be generated next
time round the loop. */
@@ -908,7 +910,7 @@ restart_loop:
J_ASSERT(commit_transaction->t_state == T_COMMIT);
commit_transaction->t_start = jiffies;
- stats.ts_logging = jbd2_time_diff(stats.ts_logging,
+ stats.u.run.rs_logging = jbd2_time_diff(stats.u.run.rs_logging,
commit_transaction->t_start);
/*
@@ -916,7 +918,7 @@ restart_loop:
*/
stats.ts_type = JBD2_STATS_RUN;
stats.ts_tid = commit_transaction->t_tid;
- stats.ts_handle_count = commit_transaction->t_handle_count;
+ stats.u.run.rs_handle_count = commit_transaction->t_handle_count;
spin_lock(&journal->j_history_lock);
memcpy(journal->j_history + journal->j_history_cur, &stats,
sizeof(stats));
@@ -927,14 +929,14 @@ restart_loop:
* Calculate overall stats
*/
journal->j_stats.ts_tid++;
- journal->j_stats.ts_wait += stats.ts_wait;
- journal->j_stats.ts_running += stats.ts_running;
- journal->j_stats.ts_locked += stats.ts_locked;
- journal->j_stats.ts_flushing += stats.ts_flushing;
- journal->j_stats.ts_logging += stats.ts_logging;
- journal->j_stats.ts_handle_count += stats.ts_handle_count;
- journal->j_stats.ts_blocks += stats.ts_blocks;
- journal->j_stats.ts_blocks_logged += stats.ts_blocks_logged;
+ journal->j_stats.u.run.rs_wait += stats.u.run.rs_wait;
+ journal->j_stats.u.run.rs_running += stats.u.run.rs_running;
+ journal->j_stats.u.run.rs_locked += stats.u.run.rs_locked;
+ journal->j_stats.u.run.rs_flushing += stats.u.run.rs_flushing;
+ journal->j_stats.u.run.rs_logging += stats.u.run.rs_logging;
+ journal->j_stats.u.run.rs_handle_count += stats.u.run.rs_handle_count;
+ journal->j_stats.u.run.rs_blocks += stats.u.run.rs_blocks;
+ journal->j_stats.u.run.rs_blocks_logged += stats.u.run.rs_blocks_logged;
spin_unlock(&journal->j_history_lock);
commit_transaction->t_state = T_FINISHED;
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
@@ -714,19 +714,20 @@ static int jbd2_seq_history_show(struct
if (ts->ts_type == JBD2_STATS_RUN)
seq_printf(seq, "%-4s %-5lu %-5u %-5u %-5u %-5u %-5u "
"%-6lu %-5lu %-5lu\n", "R", ts->ts_tid,
- 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);
+ jiffies_to_msecs(ts->u.run.rs_wait),
+ jiffies_to_msecs(ts->u.run.rs_running),
+ jiffies_to_msecs(ts->u.run.rs_locked),
+ jiffies_to_msecs(ts->u.run.rs_flushing),
+ jiffies_to_msecs(ts->u.run.rs_logging),
+ ts->u.run.rs_handle_count,
+ ts->u.run.rs_blocks,
+ ts->u.run.rs_blocks_logged);
else if (ts->ts_type == JBD2_STATS_CHECKPOINT)
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);
+ jiffies_to_msecs(ts->u.chp.cs_chp_time),
+ ts->u.chp.cs_written, ts->u.chp.cs_dropped,
+ ts->u.chp.cs_forced_to_close);
else
J_ASSERT(0);
return 0;
@@ -815,22 +816,22 @@ static int jbd2_seq_info_show(struct seq
s->journal->j_max_transaction_buffers);
if (s->stats->ts_tid == 0)
return 0;
- seq_printf(seq, "average: \n %lums waiting for transaction\n",
- jiffies_to_msecs(s->stats->ts_wait / s->stats->ts_tid));
- seq_printf(seq, " %lums running transaction\n",
- jiffies_to_msecs(s->stats->ts_running / s->stats->ts_tid));
- seq_printf(seq, " %lums transaction was being locked\n",
- jiffies_to_msecs(s->stats->ts_locked / s->stats->ts_tid));
- seq_printf(seq, " %lums flushing data (in ordered mode)\n",
- jiffies_to_msecs(s->stats->ts_flushing / s->stats->ts_tid));
- seq_printf(seq, " %lums logging transaction\n",
- jiffies_to_msecs(s->stats->ts_logging / s->stats->ts_tid));
+ seq_printf(seq, "average: \n %ums waiting for transaction\n",
+ jiffies_to_msecs(s->stats->u.run.rs_wait / s->stats->ts_tid));
+ seq_printf(seq, " %ums running transaction\n",
+ jiffies_to_msecs(s->stats->u.run.rs_running / s->stats->ts_tid));
+ seq_printf(seq, " %ums transaction was being locked\n",
+ jiffies_to_msecs(s->stats->u.run.rs_locked / s->stats->ts_tid));
+ seq_printf(seq, " %ums flushing data (in ordered mode)\n",
+ jiffies_to_msecs(s->stats->u.run.rs_flushing / s->stats->ts_tid));
+ seq_printf(seq, " %ums logging transaction\n",
+ jiffies_to_msecs(s->stats->u.run.rs_logging / s->stats->ts_tid));
seq_printf(seq, " %lu handles per transaction\n",
- s->stats->ts_handle_count / s->stats->ts_tid);
+ s->stats->u.run.rs_handle_count / s->stats->ts_tid);
seq_printf(seq, " %lu blocks per transaction\n",
- s->stats->ts_blocks / s->stats->ts_tid);
+ s->stats->u.run.rs_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->u.run.rs_blocks_logged / s->stats->ts_tid);
return 0;
}
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
@@ -612,20 +612,6 @@ struct transaction_stats_s
#define JBD2_STATS_RUN 1
#define JBD2_STATS_CHECKPOINT 2
-#define ts_wait u.run.rs_wait
-#define ts_running u.run.rs_running
-#define ts_locked u.run.rs_locked
-#define ts_flushing u.run.rs_flushing
-#define ts_logging u.run.rs_logging
-#define ts_handle_count u.run.rs_handle_count
-#define ts_blocks u.run.rs_blocks
-#define ts_blocks_logged u.run.rs_blocks_logged
-
-#define ts_chp_time u.chp.cs_chp_time
-#define ts_forced_to_close u.chp.cs_forced_to_close
-#define ts_written u.chp.cs_written
-#define ts_dropped u.chp.cs_dropped
-
static inline unsigned long
jbd2_time_diff(unsigned long start, unsigned long end)
{
-
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