From: Christopher J. Morrone Date: Mon, 16 Aug 2010 19:09:15 +0000 (+0400) Subject: b=22233 Fix types for do_div argument X-Git-Tag: 2.0.50.0~7 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=d70cf7bb7277f3a09f277fb99921e1131c9baa16 b=22233 Fix types for do_div argument do_div only support uint64_t as its first argument. i=johann,adilger,wangdi --- diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 893c66e..c88ee15 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -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) diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index ad145c8..ccae8a2 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -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);