[<prev] [next>] [day] [month] [year] [list]
Message-ID: <BLU436-SMTP246082B5421EF7A46F79187B9850@phx.gbl>
Date: Tue, 21 Jul 2015 05:26:40 +0800
From: Chen Gang <xili_gchen_5257@...mail.com>
To: swhiteho@...hat.com
CC: cluster-devel@...hat.com,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] fs: gfs2: rgrp: Use u64 instead of s64 for statistic and
square variables in gfs2_rgrp_congested()
l_srttb, a_srttb ... are statistic variables which should be always
unsigned, and sqr_diff is a square variable, which is always unsigned,
too.
Also sqr_diff is renamed to square_diff which is more preciser.
The related warning (with allmodconfig under cris for next-20150720):
CC [M] fs/gfs2/rgrp.o
In file included from arch/cris/include/generated/asm/div64.h:1:0,
from include/linux/kernel.h:137,
from include/linux/list.h:8,
from include/linux/preempt.h:10,
from include/linux/spinlock.h:50,
from include/linux/mmzone.h:7,
from include/linux/gfp.h:5,
from include/linux/slab.h:14,
from fs/gfs2/rgrp.c:12:
fs/gfs2/rgrp.c: In function 'gfs2_rgrp_congested':
include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
^
fs/gfs2/rgrp.c:1882:3: note: in expansion of macro 'do_div'
do_div(a_srttb, nonzero);
^
Signed-off-by: Chen Gang <gang.chen.5i5j@...il.com>
---
fs/gfs2/rgrp.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index c92ae7fd..08e47a0 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)
const struct gfs2_glock *gl = rgd->rd_gl;
const struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
struct gfs2_lkstats *st;
- s64 r_dcount, l_dcount;
- s64 l_srttb, a_srttb = 0;
+ u64 r_dcount, l_dcount;
+ u64 l_srttb, a_srttb = 0;
s64 srttb_diff;
- s64 sqr_diff;
- s64 var;
+ u64 square_diff;
+ u64 var;
int cpu, nonzero = 0;
preempt_disable();
@@ -1892,7 +1892,7 @@ static bool gfs2_rgrp_congested(const struct gfs2_rgrpd *rgd, int loops)
return false;
srttb_diff = a_srttb - l_srttb;
- sqr_diff = srttb_diff * srttb_diff;
+ square_diff = srttb_diff * srttb_diff;
var *= 2;
if (l_dcount < 8 || r_dcount < 8)
@@ -1900,7 +1900,7 @@ static bool gfs2_rgrp_congested(const struct gfs2_rgrpd *rgd, int loops)
if (loops == 1)
var *= 2;
- return ((srttb_diff < 0) && (sqr_diff > var));
+ return ((srttb_diff < 0) && (square_diff > var));
}
/**
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists