diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2015-08-27 13:51:45 -0400 |
---|---|---|
committer | Bob Peterson <rpeterso@redhat.com> | 2015-09-03 14:33:32 -0400 |
commit | 4d207133e9c362bc05a3bb6701d63eeb75cc4b77 (patch) | |
tree | 45de61b850feea62ac24f7891fb82634b920acd5 | |
parent | 88ffbf3e037e67b52c46d528aca1618489c21f68 (diff) |
gfs2: Make statistics unsigned, suitable for use with do_div()
None of these statistics can meaningfully be negative, and the
numerator for do_div() must have the type u64. The generic
implementation of do_div() used on some 32-bit architectures asserts
that, resulting in a compiler error in gfs2_rgrp_congested().
Fixes: 0166b197c2ed ("GFS2: Average in only non-zero round-trip times ...")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Acked-by: Andreas Gruenbacher <agruenba@redhat.com>
-rw-r--r-- | fs/gfs2/glock.c | 22 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 2 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 8 | ||||
-rw-r--r-- | fs/gfs2/trace_gfs2.h | 16 |
4 files changed, 24 insertions, 24 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index edb15eeb0ad5..37d4db1ac0b2 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -1680,17 +1680,17 @@ static int gfs2_glstats_seq_show(struct seq_file *seq, void *iter_ptr) | |||
1680 | { | 1680 | { |
1681 | struct gfs2_glock *gl = iter_ptr; | 1681 | struct gfs2_glock *gl = iter_ptr; |
1682 | 1682 | ||
1683 | seq_printf(seq, "G: n:%u/%llx rtt:%lld/%lld rttb:%lld/%lld irt:%lld/%lld dcnt: %lld qcnt: %lld\n", | 1683 | seq_printf(seq, "G: n:%u/%llx rtt:%llu/%llu rttb:%llu/%llu irt:%llu/%llu dcnt: %llu qcnt: %llu\n", |
1684 | gl->gl_name.ln_type, | 1684 | gl->gl_name.ln_type, |
1685 | (unsigned long long)gl->gl_name.ln_number, | 1685 | (unsigned long long)gl->gl_name.ln_number, |
1686 | (long long)gl->gl_stats.stats[GFS2_LKS_SRTT], | 1686 | (unsigned long long)gl->gl_stats.stats[GFS2_LKS_SRTT], |
1687 | (long long)gl->gl_stats.stats[GFS2_LKS_SRTTVAR], | 1687 | (unsigned long long)gl->gl_stats.stats[GFS2_LKS_SRTTVAR], |
1688 | (long long)gl->gl_stats.stats[GFS2_LKS_SRTTB], | 1688 | (unsigned long long)gl->gl_stats.stats[GFS2_LKS_SRTTB], |
1689 | (long long)gl->gl_stats.stats[GFS2_LKS_SRTTVARB], | 1689 | (unsigned long long)gl->gl_stats.stats[GFS2_LKS_SRTTVARB], |
1690 | (long long)gl->gl_stats.stats[GFS2_LKS_SIRT], | 1690 | (unsigned long long)gl->gl_stats.stats[GFS2_LKS_SIRT], |
1691 | (long long)gl->gl_stats.stats[GFS2_LKS_SIRTVAR], | 1691 | (unsigned long long)gl->gl_stats.stats[GFS2_LKS_SIRTVAR], |
1692 | (long long)gl->gl_stats.stats[GFS2_LKS_DCOUNT], | 1692 | (unsigned long long)gl->gl_stats.stats[GFS2_LKS_DCOUNT], |
1693 | (long long)gl->gl_stats.stats[GFS2_LKS_QCOUNT]); | 1693 | (unsigned long long)gl->gl_stats.stats[GFS2_LKS_QCOUNT]); |
1694 | return 0; | 1694 | return 0; |
1695 | } | 1695 | } |
1696 | 1696 | ||
@@ -1727,7 +1727,7 @@ static int gfs2_sbstats_seq_show(struct seq_file *seq, void *iter_ptr) | |||
1727 | loff_t pos = *(loff_t *)iter_ptr; | 1727 | loff_t pos = *(loff_t *)iter_ptr; |
1728 | unsigned index = pos >> 3; | 1728 | unsigned index = pos >> 3; |
1729 | unsigned subindex = pos & 0x07; | 1729 | unsigned subindex = pos & 0x07; |
1730 | s64 value; | 1730 | u64 value; |
1731 | int i; | 1731 | int i; |
1732 | 1732 | ||
1733 | if (index == 0 && subindex != 0) | 1733 | if (index == 0 && subindex != 0) |
@@ -1743,7 +1743,7 @@ static int gfs2_sbstats_seq_show(struct seq_file *seq, void *iter_ptr) | |||
1743 | } else { | 1743 | } else { |
1744 | value = lkstats->lkstats[index - 1].stats[subindex]; | 1744 | value = lkstats->lkstats[index - 1].stats[subindex]; |
1745 | } | 1745 | } |
1746 | seq_printf(seq, " %15lld", (long long)value); | 1746 | seq_printf(seq, " %15llu", (long long)value); |
1747 | } | 1747 | } |
1748 | seq_putc(seq, '\n'); | 1748 | seq_putc(seq, '\n'); |
1749 | return 0; | 1749 | return 0; |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index e300f7419090..121ed08d9d9f 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -244,7 +244,7 @@ enum { | |||
244 | }; | 244 | }; |
245 | 245 | ||
246 | struct gfs2_lkstats { | 246 | struct gfs2_lkstats { |
247 | s64 stats[GFS2_NR_LKSTATS]; | 247 | u64 stats[GFS2_NR_LKSTATS]; |
248 | }; | 248 | }; |
249 | 249 | ||
250 | enum { | 250 | enum { |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index c92ae7fd36f3..475985d14758 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -1862,11 +1862,11 @@ static bool gfs2_rgrp_congested(const struct gfs2_rgrpd *rgd, int loops) | |||
1862 | const struct gfs2_glock *gl = rgd->rd_gl; | 1862 | const struct gfs2_glock *gl = rgd->rd_gl; |
1863 | const struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; | 1863 | const struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; |
1864 | struct gfs2_lkstats *st; | 1864 | struct gfs2_lkstats *st; |
1865 | s64 r_dcount, l_dcount; | 1865 | u64 r_dcount, l_dcount; |
1866 | s64 l_srttb, a_srttb = 0; | 1866 | u64 l_srttb, a_srttb = 0; |
1867 | s64 srttb_diff; | 1867 | s64 srttb_diff; |
1868 | s64 sqr_diff; | 1868 | u64 sqr_diff; |
1869 | s64 var; | 1869 | u64 var; |
1870 | int cpu, nonzero = 0; | 1870 | int cpu, nonzero = 0; |
1871 | 1871 | ||
1872 | preempt_disable(); | 1872 | preempt_disable(); |
diff --git a/fs/gfs2/trace_gfs2.h b/fs/gfs2/trace_gfs2.h index fff47d0e0ef5..49ac55da4e33 100644 --- a/fs/gfs2/trace_gfs2.h +++ b/fs/gfs2/trace_gfs2.h | |||
@@ -267,14 +267,14 @@ TRACE_EVENT(gfs2_glock_lock_time, | |||
267 | __field( int, status ) | 267 | __field( int, status ) |
268 | __field( char, flags ) | 268 | __field( char, flags ) |
269 | __field( s64, tdiff ) | 269 | __field( s64, tdiff ) |
270 | __field( s64, srtt ) | 270 | __field( u64, srtt ) |
271 | __field( s64, srttvar ) | 271 | __field( u64, srttvar ) |
272 | __field( s64, srttb ) | 272 | __field( u64, srttb ) |
273 | __field( s64, srttvarb ) | 273 | __field( u64, srttvarb ) |
274 | __field( s64, sirt ) | 274 | __field( u64, sirt ) |
275 | __field( s64, sirtvar ) | 275 | __field( u64, sirtvar ) |
276 | __field( s64, dcount ) | 276 | __field( u64, dcount ) |
277 | __field( s64, qcount ) | 277 | __field( u64, qcount ) |
278 | ), | 278 | ), |
279 | 279 | ||
280 | TP_fast_assign( | 280 | TP_fast_assign( |