Whamcloud - gitweb
b=22233 Fix types for do_div argument
authorChristopher J. Morrone <morrone2@llnl.gov>
Mon, 16 Aug 2010 19:09:15 +0000 (23:09 +0400)
committerMikhail Pershin <tappro@sun.com>
Mon, 16 Aug 2010 19:25:23 +0000 (23:25 +0400)
do_div only support uint64_t as its first argument.

i=johann,adilger,wangdi

lustre/llite/rw.c
lustre/obdclass/lprocfs_status.c

index 893c66e..c88ee15 100644 (file)
@@ -587,8 +587,8 @@ static unsigned long
 stride_pg_count(pgoff_t st_off, unsigned long st_len, unsigned long st_pgs,
                 unsigned long off, unsigned long length)
 {
-        unsigned long start = off > st_off ? off - st_off : 0;
-        unsigned long end = off + length > st_off ? off + length - st_off : 0;
+        __u64 start = off > st_off ? off - st_off : 0;
+        __u64 end = off + length > st_off ? off + length - st_off : 0;
         unsigned long start_left = 0;
         unsigned long end_left = 0;
         unsigned long pg_count;
@@ -606,7 +606,7 @@ stride_pg_count(pgoff_t st_off, unsigned long st_len, unsigned long st_pgs,
         if (end_left > st_pgs)
                 end_left = st_pgs;
 
-        CDEBUG(D_READA, "start %lu, end %lu start_left %lu end_left %lu \n",
+        CDEBUG(D_READA, "start "LPU64", end "LPU64" start_left %lu end_left %lu \n",
                start, end, start_left, end_left);
 
         if (start == end)
index ad145c8..ccae8a2 100644 (file)
@@ -852,9 +852,12 @@ int lprocfs_rd_import(char *page, char **start, off_t off, int count,
                       cfs_atomic_read(&imp->imp_inval_count));
 
         lprocfs_stats_collect(obd->obd_svc_stats, PTLRPC_REQWAIT_CNTR, &ret);
-        if (ret.lc_count != 0)
-                do_div(ret.lc_sum, ret.lc_count);
-        else
+        if (ret.lc_count != 0) {
+                /* first argument to do_div MUST be __u64 */
+                __u64 sum = ret.lc_sum;
+                do_div(sum, ret.lc_count);
+                ret.lc_sum = sum;
+        } else
                 ret.lc_sum = 0;
         i += snprintf(page + i, count - i,
                       "    rpcs:\n"
@@ -896,7 +899,10 @@ int lprocfs_rd_import(char *page, char **start, off_t off, int count,
                                       PTLRPC_LAST_CNTR + BRW_READ_BYTES + rw,
                                       &ret);
                 if (ret.lc_sum > 0 && ret.lc_count > 0) {
-                        do_div(ret.lc_sum, ret.lc_count);
+                        /* first argument to do_div MUST be __u64 */
+                        __u64 sum = ret.lc_sum;
+                        do_div(sum, ret.lc_count);
+                        ret.lc_sum = sum;
                         i += snprintf(page + i, count - i,
                                       "    %s_data_averages:\n"
                                       "       bytes_per_rpc: "LPU64"\n",
@@ -907,7 +913,10 @@ int lprocfs_rd_import(char *page, char **start, off_t off, int count,
                 j = opcode_offset(OST_READ + rw) + EXTRA_MAX_OPCODES;
                 lprocfs_stats_collect(obd->obd_svc_stats, j, &ret);
                 if (ret.lc_sum > 0 && ret.lc_count != 0) {
-                        do_div(ret.lc_sum, ret.lc_count);
+                        /* first argument to do_div MUST be __u64 */
+                        __u64 sum = ret.lc_sum;
+                        do_div(sum, ret.lc_count);
+                        ret.lc_sum = sum;
                         i += snprintf(page + i, count - i,
                                       "       %s_per_rpc: "LPU64"\n",
                                       ret.lc_units, ret.lc_sum);