[Cluster-devel] [PATCH] fs: gfs2: rgrp: Use u64 instead of s64 for statistic and square variables in gfs2_rgrp_congested()

Chen Gang <[email protected]>
Newsgroups com.redhat.cluster-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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 <[email protected]>
---
 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.