Skip to content

Commit 4d20713

Browse files
bwhacksAstralBob
authored andcommitted
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: 0166b19 ("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>
1 parent 88ffbf3 commit 4d20713

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

fs/gfs2/glock.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,17 +1680,17 @@ static int gfs2_glstats_seq_show(struct seq_file *seq, void *iter_ptr)
16801680
{
16811681
struct gfs2_glock *gl = iter_ptr;
16821682

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",
16841684
gl->gl_name.ln_type,
16851685
(unsigned long long)gl->gl_name.ln_number,
1686-
(long long)gl->gl_stats.stats[GFS2_LKS_SRTT],
1687-
(long long)gl->gl_stats.stats[GFS2_LKS_SRTTVAR],
1688-
(long long)gl->gl_stats.stats[GFS2_LKS_SRTTB],
1689-
(long long)gl->gl_stats.stats[GFS2_LKS_SRTTVARB],
1690-
(long long)gl->gl_stats.stats[GFS2_LKS_SIRT],
1691-
(long long)gl->gl_stats.stats[GFS2_LKS_SIRTVAR],
1692-
(long long)gl->gl_stats.stats[GFS2_LKS_DCOUNT],
1693-
(long long)gl->gl_stats.stats[GFS2_LKS_QCOUNT]);
1686+
(unsigned long long)gl->gl_stats.stats[GFS2_LKS_SRTT],
1687+
(unsigned long long)gl->gl_stats.stats[GFS2_LKS_SRTTVAR],
1688+
(unsigned long long)gl->gl_stats.stats[GFS2_LKS_SRTTB],
1689+
(unsigned long long)gl->gl_stats.stats[GFS2_LKS_SRTTVARB],
1690+
(unsigned long long)gl->gl_stats.stats[GFS2_LKS_SIRT],
1691+
(unsigned long long)gl->gl_stats.stats[GFS2_LKS_SIRTVAR],
1692+
(unsigned long long)gl->gl_stats.stats[GFS2_LKS_DCOUNT],
1693+
(unsigned long long)gl->gl_stats.stats[GFS2_LKS_QCOUNT]);
16941694
return 0;
16951695
}
16961696

@@ -1727,7 +1727,7 @@ static int gfs2_sbstats_seq_show(struct seq_file *seq, void *iter_ptr)
17271727
loff_t pos = *(loff_t *)iter_ptr;
17281728
unsigned index = pos >> 3;
17291729
unsigned subindex = pos & 0x07;
1730-
s64 value;
1730+
u64 value;
17311731
int i;
17321732

17331733
if (index == 0 && subindex != 0)
@@ -1743,7 +1743,7 @@ static int gfs2_sbstats_seq_show(struct seq_file *seq, void *iter_ptr)
17431743
} else {
17441744
value = lkstats->lkstats[index - 1].stats[subindex];
17451745
}
1746-
seq_printf(seq, " %15lld", (long long)value);
1746+
seq_printf(seq, " %15llu", (long long)value);
17471747
}
17481748
seq_putc(seq, '\n');
17491749
return 0;

fs/gfs2/incore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ enum {
244244
};
245245

246246
struct gfs2_lkstats {
247-
s64 stats[GFS2_NR_LKSTATS];
247+
u64 stats[GFS2_NR_LKSTATS];
248248
};
249249

250250
enum {

fs/gfs2/rgrp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,11 +1862,11 @@ static bool gfs2_rgrp_congested(const struct gfs2_rgrpd *rgd, int loops)
18621862
const struct gfs2_glock *gl = rgd->rd_gl;
18631863
const struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
18641864
struct gfs2_lkstats *st;
1865-
s64 r_dcount, l_dcount;
1866-
s64 l_srttb, a_srttb = 0;
1865+
u64 r_dcount, l_dcount;
1866+
u64 l_srttb, a_srttb = 0;
18671867
s64 srttb_diff;
1868-
s64 sqr_diff;
1869-
s64 var;
1868+
u64 sqr_diff;
1869+
u64 var;
18701870
int cpu, nonzero = 0;
18711871

18721872
preempt_disable();

fs/gfs2/trace_gfs2.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,14 @@ TRACE_EVENT(gfs2_glock_lock_time,
267267
__field( int, status )
268268
__field( char, flags )
269269
__field( s64, tdiff )
270-
__field( s64, srtt )
271-
__field( s64, srttvar )
272-
__field( s64, srttb )
273-
__field( s64, srttvarb )
274-
__field( s64, sirt )
275-
__field( s64, sirtvar )
276-
__field( s64, dcount )
277-
__field( s64, qcount )
270+
__field( u64, srtt )
271+
__field( u64, srttvar )
272+
__field( u64, srttb )
273+
__field( u64, srttvarb )
274+
__field( u64, sirt )
275+
__field( u64, sirtvar )
276+
__field( u64, dcount )
277+
__field( u64, qcount )
278278
),
279279

280280
TP_fast_assign(

0 commit comments

Comments
 (0)