You may also consider making this a decaying average, so that minor changes
in the workload are smoothed out. Also, it is probably easier to read
likely(foo) instead of unlikely(!foo)...
if (likely(journal->j_average_commit_time != 0))
journal->j_average_commit_time =
(commit_time * 3 + journal->j_average_commit_time) / 4;
else
journal->j_average_commit_time = commit_time;
There is already the jbd stats patch in jbd2 that is reporting this
information for the previous transactions.
I was also going to comment on the use of jiffies here, but Ric beat me
to it.
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
--